Mac system installs JDK and configures environment

Source: Internet
Author: User

: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Agree to the agreement and click Download

Step two: When the download is complete, follow the prompts to complete the installation.

With the Finder Open, you can find the installed JDK in the path shown:

Where contents under the home folder, is the root directory of the JDK

which

The bin directory contains some of the terminal command tools that the JDK uses for development. Common tools such as: "Javac" is the role of compiling Java source files into class files (that is, self-decoding files); the "java" command is the function of running the class file. DB Directory is a Java development of an open-source relational database, the Include directory is a number of C-Language header files, the JRE directory under the Java Runtime dependent on the JDK, the Lib directory to hold the JDK development tools depend on some of the library files; The documentation for the JDK development tool in the Man directory.

Step three: After installing the JDK, you need to configure the JDK environment variables.

1. In the state of the English input method, press the keyboard "Ctrl + space" combination key, call up Spotlight Search, here you can quickly start the terminal, enter ter, and then enter, you can open the terminal:

2. If you are configuring an environment variable for the first time, you can use "touch. Bash_profile" To create a hidden configuration file for. Bash_profile (Use the "open-e. Bash_profile" command If you are editing a profile that already exists):

3. Enter "OPEN-E. Bash_profile" command:

4. Enter the following configuration:

Java_home=/library/java/javavirtualmachines/jdk1.8.0_40.jdk/contents/home
Path= $JAVA _home/bin: $PATH:.
Classpath= $JAVA _home/lib/tools.jar: $JAVA _home/lib/dt.jar:.
Export Java_home
Export PATH
Export CLASSPATH

Then save to close the window.

The following red path is replaced with the JDK path you installed

5. Use "source. Bash_profile" To make the configuration effective, and then enter "Java-version", if you see JDK version 1.8, the configuration has taken effect:

Fourth step: test the development environment

Open the terminal, directly after the command prompt input: Javac, press ENTER, the system will output the Javac help, if the success indicates that the JDK has been successfully configured, you need to carefully check the above steps are configured correctly

Mac system installs JDK and configures environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.