Java environment Configuration
This is only the process of installing EXE in windows. It is not too complex in Ubuntu. Generally, I understand the Java environment configuration and the following steps:
1. download the new JDK file from the official Oracle website, put the downloaded file in/usr/lib/JVM/Java, and decompress it. OK. JDK has been installed!
2. environment variable configuration
Run the following command on the terminal: sudo VI/etc/environment. The red part shows the added information:
Javahome =/usr/lib/JVM/Java/jdk1.7.0 _ 04
Path = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games: /usr/lib/JVM/Java/jdk1.7.0 _ 04/bin:/usr/lib/JVM/Java/jdk1.7.0 _ 04/JRE/bin"
Classpath =/usr/lib/JVM/Java/jdk1.7.0 _ 04/lib:/usr/lib/JVM/Java/jdk1.7.0 _ 04/JRE/lib
Next, set the default JDK, because the system may have another JDK by default.
Run the following command on the terminal:
Sudo Update-alternatives -- install/usr/bin/Java/usr/lib/JVM/Java/jdk1.7.0 _ 04/bin/Java 300
Sudo Update-alternatives -- install/usr/bin/javac/usr/lib/JVM/Java/jdk1.7.0 _ 04/bin/javac 300
Select the system's default JDK and run the following command on the terminal: sudo Update-alternatives -- config Java
If only one Java environment exists, the system prompts that only one JDK exists.
Finally, execute the command: Java-version
Java version "1.7.0 _ 04"
Java (TM) se Runtime Environment (build 1.7.0-b04)
Java hotspot (TM) Client VM (build 15.2-b04, mixed mode, sharing)
The following shows that the java used is Sun's Java, OK, and the environment variable is set successfully.