1.
Reference URL:
Http://www.xuebuyuan.com/2070575.html
http://blog.csdn.net/csusunxgg/article/details/8956027
2.
(1), I put Jdk-6u45-linux-x64.bin in "home" under the
(2), command "./jdk-6u45-linux-x64.bin"//This step is to unzip the file (if not superuser privileges, need to access the Jdk-6u45-linux-x64.bin settings)
(3), environment variable settings:
(3.1),
sudo vi/etc/profile
(3.2), ZC: Note This is separated by a colon
Export java_home=/usr/lib/jvm/java/jdk1.6.0_45
Export JRE_HOME=${JAVA_HOME}/JRE
Export Classpath=.:${java_home}/lib:${jre_home}/lib
Export path= $PATH: ${java_home}/bin:${jre_home}/bin
(3.3),
Source/etc/profile
Source/home/user/.bashrc
(4), set default JDK
Because there may be default JDK in Ubuntu, such as OpenJDK, so, in order to make the default use of the JDK we installed, we will do the following work.
Perform
Update-alternatives--install/usr/bin/java Java/usr/lib/jvm/java/jdk1.6.0_45/bin/java 300
Update-alternatives--install/usr/bin/javac Javac/usr/lib/jvm/java/jdk1.6.0_45/bin/javac 300
This step adds our installed JDK to the Java menu.
And then execute
Update-alternatives--config Java
Use this step to select the system default JDK
(5), test
Java-version
PS: From the webpage "http://www.powerxing.com/linux-environment-variable/"
“
In addition, modifying the/etc/environment file can also enable setting of environment variables. /etc/environment set is also a global variable, from the role of the file itself,/etc/environment set the entire system environment, and/etc/profile is to set up all users of the environment. There are a few points to note:
The system reads Etc/profile before reading/etc/environment (or vice versa). )
/etc/environment cannot contain commands, i.e. directly through var= "..." The way you set it, do not use export.
You can use Source/etc/environment to make the variable settings effective immediately in the current window, and to log off/restart before each new terminal window takes effect.
”
PS: or configure environment variables with/etc/environment files
“
1. Open/etc/environment File
sudo gedit/etc/environment
2. Add environment variables, separated by semicolons (ZC: This should be wrong, should be separated by a colon)
Path= "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/jdk1.6.0_45/bin"
Java_home= "/usr/lib/jvm/jdk1.6.0_45"
Classpath= "/usr/lib/jvm/jdk1.6.0_45/lib"
Path is used to specify the search path for the command because we need to use the command in the Jdk/bin directory, so the path needs to be added to the environment variable path; classpath is used to
Specifies the class search path; Java_home points to the JDK's installation directory, and by setting up Java_home, there is no need for JAVA configuration in Eclipse.
3. Execute the UPDATE command
$ sudo update-alternatives--install/usr/bin/java Java/usr/lib/jvm/jdk1.6.0_45/bin/java 300
$ sudo update-alternatives--install/usr/bin/javac Javac/usr/lib/jvm/jdk1.6.0_45/bin/javac 300
(Note that the 2-line command--install followed by a total of four parameters is the link name path priority, we just modify the corresponding path is OK)
”
X
Ubuntu Installation Jdk-6u45-linux-x64-rpm.bin