JDK Download path: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Java environment Configuration in Windows environment
1. Install JDK
2. Configure Environment variables
2.1, Win2000, and WinXP can find "environment variables" in the advanced option of the "My Computer" property, and you can then create new or modify them according to the following prompts
Java_home
Set as the installation directory for JDK
PATH
Set to%java_home%\bin;%java_home%\jre\bin
CLASSPATH
Set to.; %java_home%\lib;%java_home%/lib/tools.jar
Second, the Linux environment in the Java environment configuration
This article mainly introduces three kinds of methods, three methods each have advantages and disadvantages, according to different circumstances and different choices.
Method 1: Modify the/etc/profile file
All users ' shells have the right to use these environment variables
1. Execute command at Shell Terminal: vi/etc/profile
2. Add at the end of profile file:
Java_home=/usr/local/jdk1.6.0_4
Path= $JAVA _home/bin: $PATH
Classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export Java_home,path,classpath
3. Reboot system (Command reboot)
Method 2: Modify the. bashrc file
If you need to give a user permission to use these environment variables, you only need to modify the. BASHRC on the user's home directory, not like the first method gives all user permissions.
1. Execute command at Shell Terminal: VI/HOME/USERNAME/.BASHRC
2. Add at the end of the. bashrc file:
Set Java_home=/usr/local/jdk1.6.0_4
Export Java_home
Set path= $JAVA _home/bin: $PATH
Export PATH
Set classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export CLASSPATH
3. Re-Login
Method 3: Modify directly under the shell
For temporary use under the shell, which is not valid for a different shell
Export java_home=/opt/jdk1.5.0_02
Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export path= $JAVA _home/bin: $PATH
Note: Linux uses: (colons) instead of; (semicolons) to separate paths;
Third, test environment configuration
After the configuration is done, you can test the
1, in the DOS or terminal input java-version, and then output display, display is the current system JRE the highest version
2, in DOS or terminal input javac, if the corresponding prompts, indicating that the compilation environment has been configured successfully
Note: Success only means that the operating environment is successful, generally as long as the JRE installed is OK
Successfully explained that the running environment configuration was successful, then you can do basic Java programming