Installation and configuration of eclipse under Mac

1. Confirm whether the Java development environment-JDK is installed
  • Open Terminal and enter:java -version

    macdeMacBook-Pro:test-java mac$ java -version
    java version "13-ea" 2019-09-17
    Java(TM) SE Runtime Environment (build 13-ea+33)
    Java HotSpot(TM) 64-Bit Server VM (build 13-ea+33, mixed mode, sharing)
    
  • If the java version number is returned, it means it has been installed

  • Otherwise, install jdk first: configure Java development environment on Mac

2. Download and install eclipse
  • download:

    • Enter eclipse's official website http://www.eclipse.org/home/index.php

    • Click "Download" in the upper right corner of the page

    • Click "Download 64 bit" in the middle of the page

      Insert picture description here

    • Click "Download" to download

      Insert picture description here

  • installation:

    • Double-click the "eclipse-inst-mac64.dmg" file downloaded in the previous step

    • Double-click the icon

      Insert picture description here

    • There are a variety of download and installation packages listed here, and you can choose according to your needs. For example, I chose "Eclipse IDE for Java Developers":

      Insert picture description here

    • Click "INSTALL" to download and install. (If there is a problem in the process, click the menu item with a yellow exclamation mark in the upper right corner, and select "UPDATE" to update before proceeding)

      Insert picture description here

    • After the installation is complete, find the eclipse icon according to the installation path ""/Users/mac/eclipse/java-2019-12" and double-click to open it. (For ease of use, you can move to "/Applications". Find and view eclipse in Launchpad)

3. Configure JDK for eclipse
  • Click the above eclipse icon, then click "Launch" (just follow the default workspace), and then enter the eclipse preferences:

    Insert picture description here

  • Select "Installed JREs" under "java" from the left sidebar, then click the "Add" button, select "Standard VM" in the pop-up box and click the "Next" button:

    Insert picture description here

  • In the Add JRE interface, click the "Directory" button behind "JRE home" and select the Home folder path when JDK is installed. For example, mine is "/Library/Java/JavaVirtualMachines/jdk-13.jdk/Contents/Home". As for "JRE name", the default is "Home", and then click "finish" (if it has been configured, it will display "The JRE name is already in use.")

    Insert picture description here

  • Then check the JRE you just added, and then click "Apply and Close".

    Insert picture description here

4. Run a simple example
  • Click "Creat a new Java project"

    Insert picture description here

  • Enter "Project name", such as "softTest1"; JRE selects the third item "use default JRE (currently "Home")", which is the default JRE configured for eclipse above; other defaults are fine; finally click "finish" to create the project

    Insert picture description here

  • Then click "Create" directly in the pop-up box

    Insert picture description here

  • Create a package:

    • Right-click the project name softTest1->new->Package

      Insert picture description here

    • The package name in the pop-up box can be defaulted or modified

  • Create class:

    • Right-click the newly created package name softTest1->new->class

      Insert picture description here

    • The "Name" in the pop-up box can be named "HelloWorld", other defaults are fine, click "finish".

  • Write the code, click run, you can see the output in the console

    Insert picture description here


Reference link:

1. Install and configure Eclipse under Mac

Guess you like

Origin blog.csdn.net/szw_yx/article/details/104713366