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
Table of contents 1. Preface 2. Find two pop-up c...
Record the installation and configuration method ...
We will install phpMyAdmin to work with Apache on...
Good HTML code is the foundation of a beautiful w...
Table of contents 1. Prototype chain inheritance ...
Table of contents Preface 1. Use for...of to iter...
Table of contents Introduction to frm files and i...
Table of contents User Management Create a new us...
Table of contents 1. What is dynamic typing? 2. D...
Table of contents Overview Precautions 1. Usage 2...
Table of contents Introduction Using Strict mode ...
Tip: The following operations are all performed u...
There are many tutorials on the Internet, and the...
Related articles: Beginners learn some HTML tags ...
I have recently been following the CSS Animation ...