How To Select Which Variation of Java to Use in Linux (+ Video Tutorial)

Uncategorized

Which variation of Java should you utilize in Linux? Find out how to easily change between different variations with a tutorial from Jack Wallen.

You will most likely stumble upon a circumstance where you need to deal with different variations of Java; when Linux is your advancement platform, you can quickly switch in between them. For example, if a job requires Java 17, you can switch to that. When your next task requires Java 18, you can quickly make the switch. Let me show you how.

Initially, we’re going to install Java 17 and Java 18, so you can see how the changing is done.

  1. To install Java 17, open a terminal window and concern this command:

sudo apt-get set up openjdk-17-jdk openjdk-17-jre -y

  1. After that setup completes, let’s set up Java 18 with this command:

sudo apt-get install openjdk-18-jdk -y

Now Java 17 and Java 18 are set up on your device, ready to assist you construct your tasks.

  1. To switch between Java variations, problem this command:

update-alternatives– config java

This will provide you with a list of the various variations of Java you have actually set up. Each variation will be connected with a number, starting with 0.

  1. If you wish to change to Java 18, locate and type the associated number for Java 18 and hit Enter upon your keyboard. The system will set Java 18 as the current version. You can verify the switch with the following command, where you must see Java 18 noted:

java– variation

And that’s all there is to switching in between versions of Java on Linux. You can set up as many variations as you like and change in between them for various jobs on the fly.

Register for TechRepublic’s How To Make Tech Work on YouTube for all the current tech recommendations for service pros from Jack Wallen.



Source

Leave a Reply

Your email address will not be published. Required fields are marked *