This blog describes how to build a Java development environment under the Mac OSX system, with Java development environment, we can do Java related development, Eclipse and Android studio to have a JVM environment to run, so this article will briefly summarize how the Mac OSX configures the Java environment variables.
First to see the author's computer Configuration:
Open the terminal to see what shell commands are used by the 10.10 version of the system:
The output is bash, which indicates that the Bourne shell is the default UNIX shell command.
See the author's Java version from the command line below:
If your system already has a successful JDK installed, you can see the corresponding JDK version via java-version.
If your computer does not have a JDK installed, you can download the JDK on the Oracle website.
Http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
I downloaded the 1.7 version, currently the latest JDK version is 1.8.
Configuring Java Environment variables
Input sudo vim etc/profile
Edit Profile with VI
Type I, enter insert mode
At the end of the file, add the Java path
Java_home= "/library/java/javavirtualmachines/jdk1.7.0_75.jdk/contents/home/"
Class_path= "$JAVA _home/lib"
Path= ".; $PATH: $JAVA _home/bin "
When you are finished adding, press ESC to exit Insert mode and type wq! to save the exit file.
In this step, we have configured the global Java path and CLASSPATH environment variables.
In the future, Java development will be good.
Java development environment diagram under MAC OS X