Download the Java Development Kit jdk The download address of JDK is: On the download page, select the corresponding jdk version according to your system. Here, take Ubuntu 20.04 LTS (64bits) system as an example and select the compressed type Installation Steps Move the downloaded JDK to 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 the jdk to the specified jdk installation directory cd /opt # Locate the specified jdk installation directory sudo tar -xzvf jdk-14.0.1_linux-x64_bin.tar.gz # Unzip the jdk and get the folder jdk-14.0.1 sudo rm jdk-14.0.1_linux-x64_bin.tar.gz # The jdk compressed package is no longer useful, delete it At this point, the installation of JDK is halfway done. Next 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 effective source /etc/profilec Enter the following command to view, create, or update environment variables: # View the value of the environment variable echo $JAVA_HOME echo $CLASSPATH echo $PATH Test whether jdk is installed successfully Open a terminal; Type: First Java Program Code Listing: HelloWorld.java public class HelloWorld { //Entry method of Java program, the program will start execution from here public static void main(String[] args) { // Print a statement to the console System.out.println("Hello World"); } } To edit, compile and run the HelloWorld.java program:
uninstall cd /opt # Enter the jdk installation directory sudo rm -rf jdk-14.0.1 # Uninstall jdk This is the end of this article about configuring Java development environment in Ubuntu 20.04 LTS. For more information about configuring Java development environment in Ubuntu 20.04 LTS, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Detailed explanation of Vuex overall case
>>: What you need to know about MySQL auto-increment ID
1. Introduction to Flex Layout Flex is the abbrev...
Nowadays, cross-platform development technology i...
This article describes the MySQL slow query opera...
Preface This article mainly introduces 4 methods ...
Nowadays, whether you are working on software or w...
Table of contents What is native JavaScript A. Ch...
text OK, next it’s time to show the renderings. O...
Table of contents 1. Get the first link first 2. ...
Effect picture: Implementation code: <template...
Table of contents Native JS How to send a get req...
Table of contents 1. Digital Operation (1) Genera...
inline-flex is the same as inline-block. It is a ...
Learning CSS3 is more about getting familiar with...
Based on Vue and native javascript encapsulation,...
We often see ads appear after a few seconds and t...