Basic ways to install Java and configure environment variables on Mac OS _java

Source: Internet
Author: User
Tags java se

Installation
Because not all users need Java, OS X is not pre-installed in Java by default, and can be installed manually if you want.

1. http://support.apple.com/kb/DL1572
To the Apple website to download.
Http://support.apple.com/downloads/DL1572/en_US/JavaForOSX2014-001.dmg


2.http://www.oracle.com/technetwor ... ownloads/index.html
Download the latest version of the Java 8 JDK installation to Oracle.

After installation in the terminal input

Java-version

If the version is displayed, the installation is ready.

If it appears as follows, it means that the right is not installed and needs to be restarted.

No Java Runtime present, requesting install.

Find and set the $java_home on the Mac

You can use the tool command "/usr/libexec/java_home" to locate Java_home:

Locate Java:

/usr/libexec/java_home-v
Matching java Virtual Machines (1):
  1.8.0_25, x86_64:  "Java SE 8"/library/java/javavirtualmachines/jdk1.8.0_ 25.jdk/contents/home

/library/java/javavirtualmachines/jdk1.8.0_25.jdk/contents/home


You can also use the-V option to list all versions of Java_home:

$/usr/libexec/java_home-v
Matching java Virtual Machines (3):
1.7.0_45, x86_64: "Java SE 7"/library/java/javavirtualmachines/jdk1.7.0_45.jdk /contents/home
1.6.0_65-b14-462, x86_64: "Java SE 6"/system/library/java/javavirtualmachines/1.6.0.jdk/ Contents/home
1.6.0_65-b14-462, i386: "Java SE 6"/system/library/java/javavirtualmachines/1.6.0.jdk/contents/ Home

/library/java/javavirtualmachines/jdk1.7.0_45.jdk/contents/home


Configure Java_home:

$ cat ~/.profile

java_home= '/usr/libexec/java_home '
export java_home

$ echo $JAVA _home
/library/ Java/javavirtualmachines/jdk1.7.0_45.jdk/contents/home
$ source ~/.profile 
$java

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.