Configuring the Java environment in Mac OS

Source: Internet
Author: User

The Company e-commerce platform needs to increase the UnionPay payment interface, need to configure the Java environment,

Looked for such a document, but temporary this demand is shelved, so whether can be configured to succeed also without my test.

In Mac systems, the JDK has a different installation path than Windows, and the default directory is:/system/libray/frameworks/javavm.framwork/.
In this directory there is a versions directory with different versions of the JDK.

1. How do I set the default Java version in my Mac?

First look at the Mac, where the Java link is:

Go to the appropriate directory: Cd/usr/bin

See where Java is linked: Ls-l java

Localhost:bin root# ls-l Java
Lrwxr-xr-x 1 root wheel 10:26 java->/system/library/frameworks/javavm.framework/versions/current/commands /java
You can see that Java is connected to the current version. So what version is this? In fact, the Mac is only a shortcut to the current, for the convenience of setting the default java.

Where this link goes, the default Java is which. But in the Mac can keep this Java link unchanged, just change the current Java can, here are the steps:

1) Open Finder: Click the Finder icon to the point of the desktop.

2) application-->utilities-->java-->javapreferences

3) from the second step, you can open the Java Preferences dialog box and select "General" tab. In the "Javaapplication runtimesettings" section below, drag the Java version you want to the top.

The topmost Java is the current Java, so you can change the default Java version without having to reset the Java link under/usr/bin, instead of just dragging the required Java to the top.

Javahome settings in 2.MAC

In Windows, the value of Javahome is just a directory of the version number, but slightly different on the Mac, go to the home directory under the version number directory, such as:

Java_home=/system/library/frameworks/javavm.framework/versions/1.6.0/home

3. Set Java_home environment variables in Mac

Environment variables to be configured in the profile file under the ETC directory, this is the permanent configuration.

Cd/etc

VI Profile

Enter the following content:

Java_home=/system/library/frameworks/javavm.framework/versions/1.6.0/home

Export Java_home

Save. Then restart or logoff to make the configuration of the environment variable work.

In this way, the Javahome environment is configured well.

in the same way, we can configure the environment variables such as Path,calsspath in the profile file.

Configuring the Java environment in Mac OS

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.