Ubuntu 22.04.1 configures Java environment variables

1. Download JDK
This demonstration is related to jdk-17_linux-x64_bin.tar.gz

Download address : https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz

 


jdk download
===========================================================================

Introduction to Tabby

tabby is an open source and free terminal connection tool that can be used on multiple platforms, for example: windows, mac, linux and other systems are all supported

 

Download and install Tabby

Download address : Release Alpha 167 Eugeny/tabby GitHub

 ========================================================================

You can also transfer it to the ubuntu file system through Tobby in the Windows environment, or download it in the ubuntu system. 

 

2. Decompress the JDK package
        Open the terminal in the download directory, and use the following command to decompress:

root@yelan-virtual-machine:/home/xiaozhi/java# tar -zxvf jdk-17_linux-x64_bin.tar.gz 

Note: Pressing the Tab key will automatically complete the file name.

Unzip to get the jdk folder, mine is jdk-17.0.4.1,

 

Move the folder to the /usr/local directory with the following command

root@yelan-virtual-machine:/home/xiaozhi/java# mv jdk-17.0.4.1 /opt/jdk


3. Configure the Java environment
        Use the following command to open the vim ~/.bashrc file

 

If vim cannot be opened, first install the vim editor: sudo apt-get install vim;

Use the command sudo vim ~/.bashrc, and add the following at the end of the file:


Note: Press: "i" to edit, to save and exit, first press ESC and then ":WQ!" to save and exit.

 Save for last. Enter the following command to make the system configuration file .bashrc take effect immediately: source ~/.bashrc

4. Test Java installation
        Enter the java -version command in the terminal to test and get the java version information just installed

 

Enter the javac command in the terminal to get the options of javac

At this point, the ubuntu installation of the java environment ends everywhere. Thank you for your support!
 

Guess you like

Origin blog.csdn.net/z09364517158/article/details/131403741