Search on google to download oracle jdk 14 ,go to oracle download page & select deb version,I am choosing 14 instead of 15 as Jhipster does not work with 15 version.While downloading you have to register to oracle site.
Now run
sudo dpkg -i jdk-14_linux-x64_bin.deb
After this set the path to the Oracle Java executable
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-14.0.2/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-14.0.2/bin/javac 1
Choose from openjdk & oracle jdk
sudo update-alternatives --config java
Output
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode
1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode
2 /usr/lib/jvm/jdk-14.0.2/bin/java 1 manual mode
choose option number 2.
Now
sudo update-alternatives --config javac
Output:
There are 2 choices for the alternative javac (providing /usr/bin/javac).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-11-openjdk-amd64/bin/javac 1111 auto mode
1 /usr/lib/jvm/java-11-openjdk-amd64/bin/javac 1111 manual mode
* 2 /usr/lib/jvm/jdk-14.0.2/bin/javac 1 manual mode
Choose option number 2.
Now See which is your default JDK
java --version
output :
java 14.0.2 2020-07-14
Java(TM) SE Runtime Environment (build 14.0.2+12-46)
Java HotSpot(TM) 64-Bit Server VM (build 14.0.2+12-46, mixed mode, sharing)
Setting JAVA_HOME enviornment variable
Run
sudo update-alternatives --config java
output:
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode
1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode
* 2 /usr/lib/jvm/jdk-14.0.2/bin/java 1 manual mode
from here correct java path is "/usr/lib/jvm/jdk-14.0.2/bin/java"
so the enviornment variable will be
JAVA_HOME="/usr/lib/jvm/jdk-14.0.2"
Open /etc/environment and add above line,
Now to reload enviornment variables run
source /etc/environment
No comments:
Post a Comment