JDK in MAC system environment variable settings

Source: Internet
Author: User

A lot of people are asking, after downloading Oracle's JDK, environment variables don't know how to set up, so today we have an article about how JDK sets environment variables in Mac system.

IDK in the Mac system, there are actually two paths, one is the default, one is downloaded JDK, need to be updated.

The default is very easy to find. Enter Whereis Java in the terminal to see the path, use the ls-l to see the real path

/ Whereis java

/usr/bin/java

? / ls-l/usr/bin/java

/usr/bin/java-/system/library/frameworks/javavm.framework/versions/current/commands/java

? /

If you downloaded the idk from Oracle and want to update it, you first need to modify the JDK's environment variables. Oracle is downloaded by default and is installed in the

In/library/java/javavirtualmachines/

So, first we need to make a change to the Etc/profile file.

Enter shoo su[Temporary authorization]

Vi/etc/profile (enter config file)

Copy the following code into the file, and the JDK version changes according to your own download

Java_home=/library/java/javavirtualmachines/jdk1.7.0_55.jdk/contents/home

classpaht=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar

Path= $JAVA _home/bin: $PATH:

Export Java_home

Export CLASSPATH

Export PATH

After the copy is complete, save exit

Last file update: Source/etc/profile

Enter the Echo $JAVA _home. The address that you just updated appears, indicating that the modification was successful.

from:http://blog.csdn.net/fengmoon/article/details/52106694

JDK in MAC system environment variable set (GO)

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.