Home > Java > javaTutorial > body text

How to install java on ubuntu

(*-*)浩
Release: 2019-06-06 17:54:12
Original
4275 people have browsed it

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
Copy after login

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
Copy after login

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
Copy after login

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");
    }
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!