Re your first question:

possibly you may be confusing that the webupd8 script is 0.5b. That is the version of the script - it doesnt refer to the java version.

Further to the setting of the javac version.

I suspect you need to explicitly give the path of the javac compiler

i.e.

sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/java-6.31-oracle/bin/javac" 1

followed by:

sudo update-alternatives --config javac

With regards to setting up the java chrome plugin.

The master question:

How do I install Oracle JDK 6?

includes this information - since your folder structure is slightly different your link command should be:

ln -s /usr/lib/jvm/java-6.31-oracle/jre/lib/i386/libnpjp2.so ~/.mozilla/plugins/
Answer from fossfreedom on askubuntu.com
Top answer
1 of 8
151

Re your first question:

possibly you may be confusing that the webupd8 script is 0.5b. That is the version of the script - it doesnt refer to the java version.

Further to the setting of the javac version.

I suspect you need to explicitly give the path of the javac compiler

i.e.

sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/java-6.31-oracle/bin/javac" 1

followed by:

sudo update-alternatives --config javac

With regards to setting up the java chrome plugin.

The master question:

How do I install Oracle JDK 6?

includes this information - since your folder structure is slightly different your link command should be:

ln -s /usr/lib/jvm/java-6.31-oracle/jre/lib/i386/libnpjp2.so ~/.mozilla/plugins/
2 of 8
104

See this; run

sudo  update-java-alternatives --list

to list off all the Java installations on a machine by name and directory, and then run

sudo  update-java-alternatives --set [JDK/JRE name e.g. java-8-oracle]

to choose which JRE/JDK to use.

If you want to use different JDKs/JREs for each Java task, you can run update-alternatives to configure one java executable at a time; you can run

sudo  update-alternatives --config java[Tab]

to see the Java commands that can be configured (java, javac, javah, javaws, etc). And then

sudo  update-alternatives --config [javac|java|javadoc|etc.]

will associate that Java task/command to a particular JDK/JRE.

You may also need to set JAVA_HOME for some applications: from this answer you can use

export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")

for JREs, or

export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:jre/bin/java::")

for JDKs.

๐ŸŒ
Hostman
hostman.com โ€บ tutorials โ€บ switching-between-java-versions-on-ubuntu
Switching between Java Versions on Ubuntu Linux
... Upon completing the installation, use the following command to confirm the correct and successful installation of the Java version: ... To switch between Java versions and set a default version on Ubuntu Linux, you can use the update-java-alternatives command.
Discussions

how can I change the default Java version?
The AUR package should work fine. What's the output of archlinux-java status? More on reddit.com
๐ŸŒ r/linuxquestions
20
7
February 22, 2021
Java for UniFI Controller
Windows or Linux system for the controller? More on reddit.com
๐ŸŒ r/Ubiquiti
10
4
July 12, 2019
Help with setting up vscode for java on wsl
i tried to setup java on vscode, but i ended up using intellij. More on reddit.com
๐ŸŒ r/vscode
16
18
May 3, 2020
Setting JAVA_HOME path
It means that you have not configured the JAVA_HOME environment variable. Using a virtual terminal application, type in: update-alternatives --config java, which will give you the location of JDK listed under Path column. Depending on the installed version of JDK, it will be something like: /usr/lib/jvm/java-14-openjdk-amd64/bin/java If you have installed multiple versions of JDK, all of them will be listed here 2. Using text editor such as nano and terminal emulator, type in: nano /etc/profile.d/jdk_home.sh This will create and open for editing a new script file named jdk_home.sh under the location /etc/profile.d, where you need to type in: export JAVA_HOME= where JDK-Location should not include the /bin/java directories. For example: EXPORT JAVA_HOME=โ€/usr/lib/jvm/java-14-openjdk-amd64โ€ This will set your environment variable JAVA_HOME The steps above are if you have installed JDK using apt package manager tool, you also have the option of using SDKMAN which will configure all environment variables for you automatically. More on reddit.com
๐ŸŒ r/vscode
12
1
February 27, 2020
๐ŸŒ
ComputingForGeeks
computingforgeeks.com โ€บ home โ€บ switch default java version on ubuntu / debian
Switch Default Java Version on Ubuntu / Debian [Guide]
March 25, 2026 - This ensures all tools point to the same JDK version, avoiding subtle issues where java runs version 25 but jar points to version 17. JDKs installed from .deb packages (OpenJDK, Temurin) register themselves automatically. If you installed Oracle JDK from an RPM, a tarball, or a manual download, register it manually: sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-25.0.2-oracle-x64/bin/java 1 sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-25.0.2-oracle-x64/bin/javac 1 ยท The last number is the priority. Set it lower than the system packages (which use 1081+) if you want it as a secondary option, or higher if you want it as the default.
๐ŸŒ
LinuxConfig
linuxconfig.org โ€บ home โ€บ how to install and switch java versions on ubuntu linux
How to Install and Switch Java Versions on Ubuntu Linux
September 21, 2025 - Use the update-alternatives tool to manage and switch between them. ... To set JAVA_HOME, edit your ~/.bashrc or /etc/environment file to include โ€˜export JAVA_HOME=โ€/path/to/javaโ€โ€˜, replacing the path with your Java installation ...
๐ŸŒ
OneUptime
oneuptime.com โ€บ home โ€บ blog โ€บ how to install and switch java versions on ubuntu
How to Install and Switch Java Versions on Ubuntu
March 2, 2026 - # Install SDKMAN! curl -s "https://get.sdkman.io" | bash source "$HOME/.sdkman/bin/sdkman-init.sh" # Check version sdk version # List available Java versions sdk list java # Install a specific version sdk install java 21.0.2-tem # Temurin 21 sdk install java 17.0.10-tem # Temurin 17 sdk install java 11.0.22-tem # Temurin 11 # Switch in the current shell sdk use java 17.0.10-tem # Set as default sdk default java 21.0.2-tem # Show current version sdk current java ยท SDKMAN! also manages Maven, Gradle, Groovy, Kotlin, and other JVM ecosystem tools. # Full version info java -version # openjdk vers
๐ŸŒ
Laytoun' thoughts!
aboullaite.me โ€บ switching-between-java-versions-on-ubuntu-linux
Switching between Java Versions on Ubuntu linux
November 30, 2016 - If you're using Ubuntu Linux on your daily basis work, you've probably Java installed on your machine. Personally I prefer using Wepupd8 PPA to manage JAVA installation, it makes my life a lot more easier especially for updates. The Wepupd8 team didnโ€™t add any binary for Oracle JAVA installation
๐ŸŒ
Baeldung
baeldung.com โ€บ home โ€บ installation โ€บ switch between multiple java versions
Switch Between Multiple Java Versions | Baeldung on Linux
March 18, 2024 - $ sudo update-java-alternatives --set java-1.17.0-openjdk-amd64 ยท Letโ€™s verify that it has changed the version successfully: $ java --version openjdk 17.0.9 2023-10-17 OpenJDK Runtime Environment (build 17.0.9+9-Ubuntu-123.04)
Find elsewhere
๐ŸŒ
Ubuntu Shell
ubuntushell.com โ€บ change-java-version
How to Change Java Version on Ubuntu (CLI and GUI)
November 16, 2025 - Choose Java from the Groups section (from the left pane), then select the desired version of Java you wish to set as the default from the available options. Once you have done selecting your desired Java version, simply close the G Alternatives ...
๐ŸŒ
TecAdmin
tecadmin.net โ€บ switch-between-java-versions-on-ubuntu
How to Change default Java Version on Ubuntu
April 26, 2025 - Verify the Change: Confirm the switch by checking the Java version: ... Some applications require the JAVA_HOME environment variable. To set it:
๐ŸŒ
Attacomsian
attacomsian.com โ€บ blog โ€บ change-default-java-version-ubuntu
How to change the default Java version on Ubuntu
February 17, 2020 - $ java -version openjdk version "11.0.2" 2019-01-15 OpenJDK Runtime Environment (build 11.0.2+9-Ubuntu-3ubuntu118.10.3) OpenJDK 64-Bit Server VM (build 11.0.2+9-Ubuntu-3ubuntu118.10.3, mixed mode, sharing)
๐ŸŒ
Medium
salimsea.medium.com โ€บ how-to-change-java-version-in-ubuntu-a-step-by-step-guide-b12f96a12fae
How to Change JAVA Version in Ubuntu: A Step-by-Step Guide | by Salim Segaf Alqosam | Medium
July 23, 2024 - Step 1: Check Current JAVA Version First, letโ€™s see which version of Java is currently installed on your system. Open your terminal and run
๐ŸŒ
GitHub
gist.github.com โ€บ ofhouse โ€บ b6cca8006329107fa0770a8dd87f45cf
Install and manage multiple Java SDK versions on Ubuntu ยท GitHub
If you see the output for the OpenJDK 8 but you want to use the OpenJDK 11 (e.g. for starting eclipse) you can easily switch between the different versions: sudo update-alternatives --config java > There are 2 choices for the alternative java ...
๐ŸŒ
Faun
faun.pub โ€บ how-to-install-and-manage-multiple-jdk-versions-on-ubuntu-22-04-3de225c7d8c8
How to Install and Manage Multiple JDK Versions on Ubuntu 22.04 | by Achini Udari Jayasena | FAUN.dev() ๐Ÿพ
November 1, 2024 - Note the path to the version you want to set as `JAVA_HOME`. ... Save and close the file. Then apply the changes with: ... This should display the path you set. Installing and managing multiple JDK versions on Ubuntu is simple using the `update-alternatives` tool.
๐ŸŒ
DEV Community
dev.to โ€บ harsvnc โ€บ how-to-change-your-java-and-javac-version-on-ubuntu-linux-1omj
How to change your Java and javac version on Ubuntu / Linux - DEV Community
October 19, 2021 - Maybe you wanted to check out the newest features of the new java version or you have some kind of old project that only works for some older version (yes i know java ist a wora language but anyway). ... There are 2 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/lib/jvm/java-11-openjdk-armhf/bin/java 1061 auto mode 1 /usr/lib/jvm/java-11-openjdk-armhf/bin/java 1044 manual mode 2 /usr/lib/jvm/java-8-openjdk-armhf/jre/bin/java 1061 manual mode Press enter to keep the current choice[*], or type selection number:
๐ŸŒ
Linuxize
linuxize.com โ€บ home โ€บ java โ€บ how to install java on ubuntu 18.04
How to Install Java on Ubuntu 18.04 | Linuxize
February 24, 2020 - To change the default Java version just enter the version number (the number in the Selection column) and press Enter. Some applications written in Java are using the JAVA_HOME environment variable to determine the Java installation location.
๐ŸŒ
DigitalOcean
digitalocean.com โ€บ community โ€บ tutorials โ€บ how-to-install-java-with-apt-on-ubuntu-22-04
How to Install Java with Apt on Ubuntu (JRE & JDK) | DigitalOcean
February 2, 2026 - This can be resolved by setting the JAVA_HOME environment variable to the directory where Java is installed. export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 ยท If you encounter the error Cannot locate the installed JDK or JRE version, it means that the system cannot find the installed Java Development Kit (JDK) or Java Runtime Environment (JRE).
๐ŸŒ
LinuxConfig
linuxconfig.org โ€บ home โ€บ how to install specific java version on ubuntu 26.04
How to Install Specific Java Version on Ubuntu 26.04
March 15, 2026 - In auto mode, the system automatically selects the highest-priority version. In manual mode, the system uses whichever version you explicitly selected. Running sudo update-alternatives --config java and choosing a version sets it to manual mode.
๐ŸŒ
OneUptime
oneuptime.com โ€บ home โ€บ blog โ€บ how to switch between java versions on ubuntu
How to Switch Between Java Versions on Ubuntu
March 2, 2026 - # Set Java 17 as the default without interactive menu sudo update-alternatives --set java /usr/lib/jvm/java-17-openjdk-amd64/bin/java sudo update-alternatives --set javac /usr/lib/jvm/java-17-openjdk-amd64/bin/javac ยท This is useful in provisioning ...