It’s very simple under Ubuntu, you just need to use the source installation
In addition, you can use Linux Install the general bin package, download the official bin package, install and unzip it on the terminal, and then modify the environment variable to point to the jdk.
Choose different versions according to your needs and download the bin package(Recommended learning: Java video tutorial)
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Choose your own installation platform, download and unzip it, I chose jdk-8u101-linux-x64.tar.gz
sudo tar zxvf ./jdk-8u101-linux-x64.tar.gz -C /usr/java/jdk1.8.0_101
Java environment configuration
JAVA_HOME=/usr/java/jdk1.8.0_101 JRE_HOME=$JAVA_HOME/jre JAVA_BIN=$JAVA_HOME/bin CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/binexport JAVA_HOME JRE_HOME PATH CLASSPATH 退出后: source ~/.bashrc
JAVA_HOME, JRE_HOME combined with your own path
Test Hello World!
class hello { public static void main(String[] args) { System.out.print("Hello world!\n"); } }
For more Java-related technical articles, please visit the Java Development Tutorial column to learn!
The above is the detailed content of How to install java on ubuntu. For more information, please follow other related articles on the PHP Chinese website!