Ubuntu install java environment variables

After successfully installing Ubuntu, it is often necessary to install and configure the Java environment to support the operation of other jre-based software, such as tomcat. So the first thing after installing Ubuntu is to install and configure the Java environment. The following will teach you how to achieve this step by step.

 Download jdk, the current version is jdk-8u45.

 

Open the /etc/profile file with the command sudo vi /etc/profile and add the following three lines at the end of the file:
export JAVA_HOME=/usr/lib/jdk1.8.0_45
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
save document.

Enter the command sudo source /etc/profile to make it take effect, and then use the command java -version. If you see the java version information, it means that the installation is successful.
  1.  

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326490572&siteId=291194637