Skip to content

Latest commit

 

History

History

prompts

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Prompts

Shell Scripts

Install Java 21 on WSL2

Could you please provide the most recent version of the Bash shell script designed for installing Java 21 on an Ubuntu system running under Windows Subsystem for Linux 2 (WSL2)? The script should specifically focus on the following tasks:

- Downloading the OpenJDK 21 tar.gz file from the URL 'https://download.java.net/java/GA/jdk21.0.1/415e3f918a1f4062a0074a2794853d0d/12/GPL/openjdk-21.0.1_linux-x64_bin.tar.gz'.
- Extracting the downloaded file to a predetermined directory, preferably '/usr/local/java'.
- Ensuring the script includes error handling for each step, such as checking if the download or extraction processes fail.
- Providing informative output messages to indicate the progress of each step in the script.

It is important to note that there is no need to set or modify any environment variables in the user's shell configuration files, such as .bashrc, since I use the Fish shell and will configure the environment separately. The script should solely focus on the download and extraction processes without any system-wide environment configuration.