Install
Take JDK1.6.0_43 as an example
Download jdk-6u43-linux-x64.bin, http://www.oracle.com/technetwork/java/javase/downloads/index.html
Add executable permissions chmod +x jdk-6u43-linux-x64.bin,
Execute ./jdk-6u43-linux-x64.bin to generate directory jdk1.6.0_43
Copy to /usr/share, mv jdk1.6.0_43 /usr/share
In addition, jdk-6u43-linux-x64.bin decompresses all files to the jdk$verison_$update directory of the current directory.
jdk-6u43-linux-x64-rpm.bin decompress to generate rpm package, install it with rpm -ivh command
Configure environment variables
Add in /etc/profile
# set Java environmentJAVA_HOME=/usr/share/jdk1.6.0_43PATH=$JAVA_HOME/bin:$PATHCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jareexport JAVA_HOMEexport PATHexport CLASSPATH
test
[root@localhost ~]# echo $JAVA_HOME/usr/share/jdk1.6.0_43[root@localhost ~]# echo $PATH/usr/share/jdk1.6.0_43/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin[root@localhost ~]# echo $CLASSPATH.:/usr/share/jdk1.6.0_43/lib/dt.jar:/usr/share/jdk1.6.0_43/lib/tools.jar[root@localhost ~]# java -versionjava version "1.6.0_43"Java(TM) SE Runtime Environment (build 1.6.0_43-b01)Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01, mixed mode)
Summarize
The above is the installation and configuration of Java environment variables under Linux introduced to you by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support to Wulin.com website!