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.comRe 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/
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.
how can I change the default Java version?
Java for UniFI Controller
Help with setting up vscode for java on wsl
Setting JAVA_HOME path
Videos
Apt-get won't overwrite the existing java versions.
To switch between installed java versions, use the update-java-alternatives command.
List all java versions:
update-java-alternatives --list
Set java version as default (needs root permissions):
sudo update-java-alternatives --set /path/to/java/version
...where /path/to/java/version is one of those listed by the previous command (e.g. /usr/lib/jvm/java-7-openjdk-amd64).
Additional information:
update-java-alternatives is a convenience tool that uses Debian's alternatives system (update-alternatives) to set a bunch of links to the specified java version (e.g. java, javac, ...).
Use
sudo update-alternatives --config java
which lists all installed versions with current active one marked and provides dialog to switch:
There are 3 choices for the alternative java (providing /usr/bin/java).
Selection Path...
------------------------------------------------------------
0 /usr/lib/jvm/java-9-oracle/bin/java...
* 1 /usr/lib/jvm/java-7-oracle/jre/bin/java...
2 /usr/lib/jvm/java-8-oracle/jre/bin/java...
3 /usr/lib/jvm/java-9-oracle/bin/java...
Press <enter> to keep...[*], or type selection number:
Use
export JAVA_HOME="$(jrunscript -e 'java.lang.System.out.println(java.lang.System.getProperty("java.home"));')"
to set $JAVA_HOME from current active version