Software Environment:
Virtual machines: VMware Workstation 10
Operating system: UBUNTU-12.04-DESKTOP-AMD64
Java version: jdk-7u55-linux-x64
Software:
jdk:http://www.oracle.com/technetwork/java/javase/downloads/index.html (directly download. tar.gz formatted files)
First stage: first check whether the operating system has installed the JDK environment, press "ctrl+alt+t" Outbound terminal, enter the command:
Java–version
If the JDK version information appears, it is already installed, otherwise the following results will be displayed:
Let's continue with the installation, drag the downloaded JDK package into Ubuntu desktop, drag and drop it once, and try a few more times until the desktop appears with the JDK compression package you just downloaded.
Then cut the compressed package to the main folder under "Downloads":
Right-click to select "Extract Here":
Then, exhale the terminal and enter the command:
sudo mv downloads/jdk1.7.0_55/usr/lib/jvm/
Note that the spelling of this downloads must be the same, if it is not possible to enter the LS copy directory name it.
Go to the "USR/LIB/JVM" directory and check the file:
Then, you can get rid of the name of this directory, just don't forget it.
Phase II: Start setting environment variable equivalence
Outgoing terminal, input command:
Gedit ~/.BASHRC
The text editing interface appears:
Paste the configuration to the end of the document:
Export java_home=/usr/lib/jvm/jdk1.8.0_144
Export JRE_HOME=${JAVA_HOME}/JRE
Export Classpath=.:${java_home}/lib:${jre_home}/lib
Export Path=${java_home}/bin: $PATH
Then press the Save shortcut key (Ctrl+s) to turn off text editing.
Note that I do not change the JDK path here, so use the jdk1.7.0_55, if you have changed the directory name before, please use the new name.
Save the environment variable, exit the editor, and enter the command to take effect:
SOURCE ~/.BASHRC
You can enter the ENV command to see if the settings are successful
You can also enter the java-version command to test the JDK version to see the JDK version:
Java-version
If the result is similar to the following interface, the configuration succeeds.
Enjoy It.
The detailed steps above can be replaced with one command in the case of networking:
sudo apt-get install OPENJDK-7-JDK
Then perform java-version to view installation details.
Installing the JDK on Linux (reproduced)