Configure Java development environment in Ubuntu20.04 LTS

Download the Java Development Kit jdk

The download address of jdk is: http://www.oracle.com/technetwork/java/javase/downloads/index.html. Click the JDK Download link in the red box.

On the download page, select the corresponding jdk version according to your own system. Here, take the Ubuntu 20.04 LTS (64bits) system as an example, select the compression type jdk-14.0.1_linux-x64_bin.tar.gz to download.

installation steps

Move the downloaded jdk to desktop, and then install it according to the following steps:

cd desktop#Locate the directory where the jdk compressed package is located
sudo cp /home/ym/desktop/jdk-14.0.1_linux-x64_bin.tar.gz /opt #Copy jdk to the specified jdk installation directory
cd /opt #Navigate to the specified jdk installation directory
sudo tar -xzvf jdk-14.0.1_linux-x64_bin.tar.gz #Unzip jdk, get the folder jdk-14.0.1
sudo rm jdk-14.0.1_linux-x64_bin.tar.gz #At this time the jdk compression package is useless, delete it

At this point, the installation of jdk has been half completed, the next step is to configure jdk, the configuration steps are as follows:

# Open the system-level configuration file profile
sudo vi /etc/profile
# Add the following configuration content at the end of the file
JAVA_HOME=/opt/jdk-14.0.1 #Configuration content
CLASSPATH=.
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH
# Make the modified configuration take effect
source /etc/profilec

Enter the following commands to view or create or update environment variables:

# View the value of environment variables
echo $JAVA_HOME   
echo $CLASSPATH
echo $PATH

Test whether the jdk is installed successfully

Open a terminal;

Type: java -version, javac -version these two commands, if the following version information about Java and Java compiler appears, it means that the jdk has been installed successfully, and that the system environment variables have been configured successfully.

The first Java program

Code listing: HelloWorld.java

publicclassHelloWorld{//The entry method of the Java program, the program will start to execute publicstaticvoidmain from here(String[] args){//Print a statement to the console
 System.out.println("Hello World");}}

Steps to edit, compile and run HelloWorld.java program:

Uninstall

cd /opt        #Enter the jdk installation directory
sudo rm -rf jdk-14.0.1 #Uninstall jdk

Recommended Posts

Configure Java development environment in Ubuntu20.04 LTS
Ubuntu18.10 configure Java environment
CentOS 7 configure Java language development environment
Ubuntu configuration development environment
Ubuntu development environment configuration
How to configure TensorFlow use environment in Ubuntu
Embedded Linux development environment to build and configure Ubuntu
Complete steps to configure IP address in Ubuntu 18.04 LTS
ubuntu build python development environment
ubuntu builds common development environment
Ubuntu 18.04.1 build Java environment and HelloWorld
CentOS 7 configure Ruby language development environment
Install and configure Docker in Ubuntu
CentOS 7 configure Python language development environment
Build a LAMP development environment on Ubuntu 16.04
About installing node environment in Ubuntu server
Download OpenJDK11 source code in Ubuntu environment
Build a python development environment under Ubuntu
Configure Nginx + PHP 7.0 + MySQL environment under Ubuntu 16.04
Docker those things in the Ubuntu environment
Edit OpenJDK11 source code in Ubuntu environment
Install JDK and configure environment variables on Ubuntu 16.04
How to install python in ubuntu server environment
Install Python3 environment in a brand new Ubuntu
Ubuntu configure Tomcat
How to configure /var/log/messages in Ubuntu system log
Remotely connect to MySQL database in Ubuntu environment
Ubuntu configure Apache
Installation and use of SSH in Ubuntu environment
Build a basic environment for Java development under Centos7
Installation and simple practice of MySQL in ubuntu environment (1)
How to create a Python virtual environment in Ubuntu 14.04
Tutorial for setting up FTP server in Ubuntu 16.04 environment
Install and configure Mono production environment on Ubuntu Server
Resolve the problems encountered in the linux environment under ubuntu
Install mysql-pytho in Ubuntu
Nagios3 in ubuntu serve
ubuntu16.04 deploy GPU environment
Ubuntu 18.04 LTS LAMP build
Ubuntu18.04.3 LTS first experience
Use supervisor in ubuntu
ubuntu 14.04 configure 3-wire 3IP
Ubuntu configure network commands
Ubuntu 18.04 LTS quickly beautified
Python virtual environment: Ubuntu16.04
Ubuntu Touch environment setup
Install python in Ubuntu
Install JDK in Ubuntu19.10
Ubuntu 18.10 configure Nvidia driver
Centos7 configure nodejs environment
ubuntu environment deployment project
Configure CentOS7 GPU environment
Ubuntu configure SecureCRT login
How to install memcache and start it in ubuntu environment
Encountered in the process of building a virtual environment in ubuntu
Detailed steps for installing Django under Python 3.6 in Ubuntu 16.04 environment
How to compile and install PHP and Nginx in Ubuntu environment