Home >Java >javaTutorial >How to install java on ubuntu

How to install java on ubuntu

(*-*)浩
(*-*)浩Original
2019-06-06 11:32:254360browse

It’s very simple under Ubuntu, you just need to use the source installation

How to install java on ubuntu

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn