How do I change Java version in Linux
William Taylor
Updated on March 24, 2026
To switch between installed java versions, use the update-java-alternatives command. … where /path/to/java/version is one of those listed by the previous command (e.g. /usr/lib/jvm/java-7-openjdk-amd64 ).
How do I downgrade Java version in Linux?
- You have to install the openjdk-8-jre : sudo apt-get install openjdk-8-jre.
- Next switch to the jre-8 version: $ sudo update-alternatives –config java There are 2 choices for the alternative java (providing /usr/bin/java).
How do I use a different version of Java?
- Open Command Prompt by pressing Start Key + R. Type cmd and press Enter.
- Type “java -version” and press Enter.
- You will see which version of Java is currently on the path. It will start with 1. X.X, so if it is 1.7. 0_05 it is Java 7.
How do I update Java in Linux terminal?
- Check which version of the JDK your system is using: java -version. …
- Update the repositories: sudo apt-get update.
- Install OpenJDK: …
- Verify the version of the JDK: …
- If the correct version of Java is not being used, use the alternatives command to switch it: …
- Verify the version of the JDK:
How do I change java?
Enable the latest installed version of Java in the Java Control Panel. In the Java Control Panel, click on the Java tab. Verify that the latest Java Runtime version is enabled by checking the Enabled box. Click OK in Java Control Panel window to confirm changes and close the window.
How do I revert back to an older version of Java?
- Step 1: Uninstall current version of Java. Access the Control Panel: In Windows 7 select the Windows button, then select Control Panel. …
- Step 2: Install desired version of Java. Go to Oracle’s Java SE 8 Archive Downloads page and locate the desired version of Java.
How do I install an older version of Java on Linux?
apt-get install -d sun-java-jdk / openjdk-6-jdk — the -d will only download the file into your /var/cache/apt/arhives folder. dpkg -i –force-downgrade /var/cache/apt/archives/sun-java-jdk (the version # that you have). Lock Version in Synaptic so ubuntu doesn’t try to upgrade it again.
How do I change Java version in Ubuntu?
To switch between installed java versions, use the update-java-alternatives command. … where /path/to/java/version is one of those listed by the previous command (e.g. /usr/lib/jvm/java-7-openjdk-amd64 ).How do I update Java 11 on Linux?
- Download the required file: For Linux x64 systems: jdk-11. interim. …
- Change the directory to the location where you want to install the JDK, then move the . tar. …
- Unpack the tarball and install the downloaded JDK: $ tar zxvf jdk-11. …
- Delete the . tar.
- Open the terminal (Ctrl+Alt+T) and update the package repository to ensure you download the latest software version: sudo apt update.
- Then, you can confidently install the latest Java Development Kit with the following command: sudo apt install default-jdk.
How do I install two Java versions on Linux?
- Step 1: Install SDKMAN. Open a new terminal and enter curl -s “ | bash. …
- Step 2: List available JDKs. See the available Java versions offered by SDKMAN by giving the following command sdk list java. …
- Step 3: Install parallel JDKs. …
- Step 4: Switch between JDKs. …
- Step 5: Uninstall a JDK.
How do I switch from Java 11 to Java 8 Ubuntu?
- You have to install the openjdk-8-jre : sudo apt-get install openjdk-8-jre.
- Next switch to the jre-8 version: $ sudo update-alternatives –config java There are 2 choices for the alternative java (providing /usr/bin/java).
How do I update my version of Java?
Go to the Windows Start Button and select Settings then Control Panel. Click Java in the Control Panel list, it has an icon of a coffee cup with steam. Select the Update tab then click the Update Now button. Click Yes to allow changes.
How do I upgrade to java 11?
- Download and install a Java 11 JDK, if haven’t.
- Open VS Code and open File> Preferences > Settings menu. A Settings view will be launched in your editor window.
- In Settings view, search for configuration “java. …
- In Settings view, search for configuration “java. …
- Restart VS Code, and now you are set to go.
How can I check my java version?
Type “java -version” into the Command Prompt, then press Enter on your keyboard. After a moment, your screen should display the information your computer has about Java, including what version you have installed.
How do I rollback a Java update?
Open the Windows Control Panel and choose Program and Features (Windows 7). Locate the installed Java update and click uninstall to remove. Once the removal process completed, you may need to restart your computer.
Is Java 1.8 the same as Java 8?
In JDK 8 and JRE 8, the version strings are 1.8 and 1.8. … Here are some examples where the version string is used: java -version (among other information, returns java version “1.8. 0” )
How do I remove old JDK from Linux?
- Open Terminal Window.
- Login as the super user.
- Try to find jre package by typing: rpm -qa.
- If RPM reports a package similar to jre- -fcs then Java is installed with RPM. …
- To uninstall Java, type: rpm -e jre- -fcs.
How do I uninstall the latest version of Java?
- Click Start.
- Select Settings.
- Select System.
- Select Apps & features.
- Select the program to uninstall and then click its Uninstall button.
- Respond to the prompts to complete the uninstall.
How do I find Java version on Linux?
- Open a terminal window.
- Run the following command: java -version.
- The output should display the version of the Java package installed on your system. In the example below, OpenJDK version 11 is installed.
How do I update Java 11 on Ubuntu?
- Step 1: Install Oracle JDK 11. The first thing you need to do is update the system, using the following command: sudo apt update && sudo apt upgrade. …
- Step 2: Install Oracle JDK 11 in Ubuntu 18.04/18.10. Once again, you start by adding PPA: Open the Ubuntu terminal, either from app launcher or by pressing Clt + Alt + T.
Where is Java path set in Linux?
- Change to your home directory. cd $HOME.
- Open the . bashrc file.
- Add the following line to the file. Replace the JDK directory with the name of your java installation directory. export PATH=/usr/java/<JDK Directory>/bin:$PATH.
- Save the file and exit. Use the source command to force Linux to reload the .
How do I update Java to 1.8 Linux?
- Step 1: Check the current Java version. …
- Step 2: Download Java 1.8v for CentOS 6. …
- Step 3: Install downloaded JDK: …
- Step 4: Verify Java Version.
How do I update Java 16 on Ubuntu?
- sudo add-apt-repository ppa:linuxuprising/java. Press enter when it tells you. …
- sudo apt update. …
- sudo apt install oracle-java16-installer. …
- java –version. …
- sudo add-apt-repository –remove ppa:linuxuprising/java. …
- sudo apt-get remove oracle-java16-installer. …
- java –version.
How do I install the latest version of JMeter in Ubuntu?
- Step 1 – Create Atlantic.Net Cloud Server. First, Login to your Atlantic.Net Cloud Server. …
- Step 2 – Install Java. …
- Step 3 – Install Apache Web Server. …
- Step 4 – Install Apache JMeter. …
- Step 5 – Launch the Apache JMeter Application. …
- Step 6 – Run Test and get the test result.
How do I install Java on Linux?
- Change to the directory in which you want to install. Type: cd directory_path_name. …
- Move the . tar. gz archive binary to the current directory.
- Unpack the tarball and install Java. tar zxvf jre-8u73-linux-i586.tar.gz. The Java files are installed in a directory called jre1. …
- Delete the . tar.
How do I install and replace between Java versions?
- Check whether your Ubuntu is 32-bit or 64-bit file /sbin/init.
- Use the following command to extract the downloaded file sudo tar -xvf <your file name>.tar.gz.
- Step 5. Open /etc/profile file. …
- Now reload the environment . / etc/profile.
How do you install both Java 8 and 11?
- Install both/all versions of Java you will want to use – for this tutorial it will be just 8 & 11.
- Make sure there is no “default” version – we don’t want “any” version running by default.
- Set the appropriate envronment variables to start Java 8 or Java 11.
- Start the appropriate version or myrobotlab.
Can I have two versions of Java on Linux?
JDK/JRE are available in two versions. … e.g. for JDK 11 choose from openjdk-11-jdk-headless and openjdk-11. When the java application does not use a graphical user interface the headless version can be used.
How do I make Java 8 default in Linux?
Choose your default Java Version. sudo update-java-alternatives -s $(sudo update-java-alternatives -l | grep 8 | cut -d ” ” -f1) || echo ‘. ‘ It will automatically fetch any java 8 version available and set it using the command update-java-alternatives .
How do I make Java 11 default in Linux?
- First, update the apt package index with: sudo apt update.
- Once the package index is updated install the default Java OpenJDK package with: sudo apt install default-jdk.
- Verify the installation, by running the following command which will print the Java version: java -version.