Installing
-
4. Installing
Then to Install Java JDK 10
First, Make a jvm Directory if Not already there with:sudo su -c 'if [ ! -d "/usr/lib/jvm" ]; then mkdir /usr/lib/jvm; fi'
If Got “User is Not in Sudoers file” then see: How to Enable sudo
Set the root superUser as owner:sudo chown -R root:root /tmp/jdk-10*
Reiterate the Execution Permission over the Java binaries:
sudo chmod -R +x /tmp/jdk-10*/bin
Finally, Shift the Java contents with:
sudo mv /tmp/jdk-10* /usr/lib/jvm/
-
5. Updating
Again to Update System Java to JDK 10
You can directly Copy & Paste the below Commands into Terminal:sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-10*/bin/java 1065
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-10*/bin/javac 1065
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk-10*/bin/jar 1065
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk-10*/bin/javaws 1065
Checking or Setting the System Java Version in Use with:
sudo update-alternatives --config java
And for the Compiler instead:
sudo update-alternatives --config javac
To Switch of Java Version Just Enter the Selection Number on First, Column. :)
-
6. Setting Up JAVA_HOME
Setting JAVA_HOME User Environment Variable (Optional)
To Edit the Bash environment Configuration file:nano $HOME/.bashrc
And Append:
export JAVA_HOME=/usr/lib/jvm/jdk-10*
Possibly to Check the JDK 10 exact PATH use in another window:
ls /usr/lib/jvm/
Ctr+x to Save & Exit from nano Editor :)
To Load the New Bash Config:bash
Contents