Manual JDK Installation on Linux

Manual JDK Installation on Linux

You may install JDK with sudo apt-get install command, but in this case you don't control which exactly version will be installed.
If you need specific version (for example, "jdk1.8.0_144") - it's better to install it manually.
Here are simple steps for this:
  1. Download JDK version you need from the official web site: https://www.oracle.com/technetwork/java/javase/downloads/index.html
  2. Unpack it (for example, to /opt/java folder)
  3. Create symbolic links for java (and also for Java compiler -javac, and Java Web Start - javaws):
Go to /usr/bin folder:
cd /usr/bin/
Check if there are already sym links:
ls -al | grep java
Remove old symbolic links (if they exist):
sudo rm -Rf java
sudo rm -Rf javac
sudo rm -Rf javaws
Create new symbolic links to required Java version:
sudo ln -s /opt/java/jdk1.8.0_144/bin/java java 
sudo ln -s /opt/java/jdk1.8.0_144/bin/javac javac 
sudo ln -s /opt/java/jdk1.8.0_144/bin/javaws javaws
4. Check java version (in new terminal), sample:
 lifedev@solutions:~$ java -version
 java version "1.8.0_144"
 Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
 Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
5. Set the JAVA_HOME environment variable: edit file "/etc/environment" and add line:

 JAVA_HOME="/opt/java/jdk1.8.0_144"
Run command:   source /etc/environment

Check JAVA_HOME environment variable:
echo $JAVA_HOME

Comments

Popular posts from this blog

Liferay Search Container Example

Liferay DXP - max upload file size

Liferay Keycloak integration