Ubuntu java environment variable configuration

1. First upload jdk installation package to / usr / local general need to manually install the software on the Software folder may encounter the following problems xftp can not upload files using an error state, the solution due to the default folder read and write read-only attribute so easy to modify the properties on the map, then chmod 777 / usr / local

2. Extract the installation package tar -zxvf installation package

3. Create the / usr / local following new folder java mkdir java, and the extract from the installation packages into java folder mv jdk_XXXXXX / usr / local / java

4. Modify the user java file folder has file permissions chown -R root: root / usr / local / java

5. configuration environment variable vi / etc / environment after the file is added, what version jdk corresponding to do the corresponding modification, I have here is 1.8.0

export JAVA_HOME=/usr/local/java/jdk1.8.0_152
export JRE_HOME=/usr/local/java/jdk1.8.0_152/jre
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib

6. modify user environment variables vi / etc / profile add a new line  

export JAVA_HOME=/usr/local/java/jdk1.8.0_152
export JRE_HOME=/usr/local/java/jdk1.8.0_152/jre
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin

7. Update the variable source / etc / profile 

8. Finally check the java environment variables java -version If not, check the previous step if the java version of reality proves successful

java version "1.8.0_152"
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)

 

 

 

tomcat installation: just need to upload tomcat installation package, unzip to run

Guess you like

Origin www.cnblogs.com/zmeRecord/p/11786085.html