this post was last edited by Zhai on 2013-11-19 23:00 1. Download the JDK Oracle Official: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html Linux 32bit Download jdk-7u-linux-i586.tar.gz Linux 64bit Download jdk-7u-linux-x64.tar.gz 2. Unzip the JDK
- Tar xzvf jdk-7u-linux-i586.tar.gz
Copy Codeor tar xzvf jdk-7u-linux-x64.tar.gz 3. Setting Environment variables The Linux global variable is set in the/etc/profile file, and the variable in the file takes effect for all users Linux User variables are set at ~/.bash_profile This article is set to Global, and the Java_home,classpath variable is set in the/etc/profile file
- sudo vi/etc/profile
Copy CodePress I to enter insert mode, the cursor moves to the end of the file, add the following:
- Export java_home=/usr/local/java/jdk1.7.0_21
- Export classpath=.: $JAVA _home/lib: $CLASSPATH
- Export path= $JAVA _home/bin: $PATH
Copy CodePress ESC, enter: Wq save 4. Whether the test environment variable is in effect
- source/etc/profile
- java-version
Copy CodeDisplay Java information such as: |
Linux configuration java (JDK) environment variables