1. Download jdk-7u67-linux-x64.tar.gz
2. Upload the appropriate folder to Ubuntu using the FTP client tool FileZilla. If it is not possible to upload to the specified folder if the folder permissions are insufficient, modify the folder executable permission, the simplest way is to give permission, that is:
- chmod 777 Folder
- (777) for maximum privileges
3. Self-extracting installation JDK, I unzipped under the/usr/cpy
- TAR-XZVF jdk-7u67-linux-x64.tar.gz
The jdk1.7.0_67 folder is generated when the installation is complete
4. Setting environment variables, it is more convenient for users unfamiliar with VI to start a text editor with the gedit command than the VI command
- sudo gedit/etc/profile
Add the following and save the exit
Original content:
Path= "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
Newly added content:
Export Java_home= "/usr/cpy/jdk1.7.0_67"
Classpath= $CLASSPATH.: $JAVA _home/lib: $JAVA _home/jre/lib
Export path= $PATH: $JAVA _home/bin: $JAVA _home/jre/bin
Add $PATH to the front of the path=
Execute the following command to make the configuration effective
Source/etc/profile
Note: path= "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" must be retained, Doing so will cause the system not to log in. You can also use another two configurations instead of the line configuration:
5. How to unload your own OPENJDK:
- sudo apt-get remove openjdk*
6. Set the default JDK (if you have OpenJDK)
Because there may be default JDK in Ubuntu, such as OpenJDK. If there is a openjdk, so, in order to make the default use of the JDK we installed, also do the following ( you can use this command to install other commands, such as Eclipse).
Execute code:
- sudo update-alternatives--install/usr/bin/java Java/opt/jdk1.7.0_25/bin/java 300
- sudo update-alternatives--install/usr/bin/javac Javac/opt/jdk1.7.0_25/bin/javac 300
This step adds our installed JDK to the Java selection list.
Then execute the code:
- sudo update-alternatives--config java
- sudo update-alternatives--config javac
Use this step to select the system default JDK
7. View the Java version and display the JDK set for ourselves
[Email protected]$ java-version
Java Version "1.7.0_25"
Java (TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot (TM) Server VM (build 23.25-b01, Mixed mode)
Note: You can also use this method to configure a multi-JDK version, just modify the/etc/environment content and follow the steps below.
Install and configure Java JDK in Ubuntu, and uninstall your own openjdk (Ubuntu 14.04 for example)