1. source code package preparation: first download jdk and supervisor from the official website.
1. source code package preparation:
First, download jdk and supervisor from the official website.
2. decompress the source code package.
Create a java folder in the/usr/local directory on the terminal and run the following command:
sudo mkdir /usr/local/java
Copy the downloaded package to the java folder and run the following command:
Go to the directory where the jdk source code package is located
cp jdk-7u45-linux-x64.tar.gz /usr/local/java
Go to the java directory and run the following command:
cd /usr/local/java
Decompress the package and run the following command:
sudo tar xvf jdk-7u45-linux-x64.tar.gz
Then you can delete the compressed package. command line:
sudo rm jdk-7u45-linux-x64.tar.gz
3. set jdk environment variables
The global setting method is used to modify the etc/profile, which is an environment variable shared by all users.
sudo gedit /etc/profile
Open and add at the end
export JAVA_HOME=/usr/local/java/jdk1.7.0_45export JRE_HOME=/usr/local/java/jdk1.7.0_45/jreexport CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATHexport PATH=$JAVA_HOME/bin: $PATH
Remember, do not add spaces on both sides of the equal sign during the above process. otherwise, "invalid identifiers" will appear, because unnecessary spaces cannot be identified during source/etc/profile, it is understood as part of the path.
Then save
source /etc/profile
Make profile take effect
4. check whether the installation is successful.
On the terminal
java -version
Check whether the installation is successful
The result is as follows:
Java version "1.7.0 _ 45"
Java (TM) SE Runtime Environment (build 1.7.0 _ 45-b18)
Java HotSpot (TM) 64-Bit Server VM (build 24.45-b08, mixed mode)