Install JAVA on Ubuntu 18.04 LTS manually
How
to install JAVA on Ubuntu 18.04 LTS manually.
Prerequisites:-
Make sure
the non root user is under sudo group.
Install the
tar.gz file of java 8 or any version you want
(I did it
with java1.8.0_221)
Steps to Perform:
Step1:
unzip the java….tar.gz file accordingly to any folder
Step2:
Check if /usr/lib/ has a java or jvm or any other repository of jdk home if not
present then create one.
$ sudo
mkdir /usr/lib/java
(java is
home of jdk dir)
Step3: move
the unzip jdk to the following newly created ‘java’ directory.
$ sudo mv
/sourcefile /usr/lib/java
Change
sourcefile with the unzip jdk path and paste it to /usr/lib/java
Step4:
check if java or javac executable file is created under /usr/bin/
If not
present then run the following commad if present then something is wrong either
is not completely installed earlier
For JAVA:
$ sudo update-alternatives --install
"/usr/bin/java" "java" "/usr/lib/java/jdk(version/folder)
/bin/java" 1
For JAVAC
$ sudo update-alternatives --install
"/usr/bin/javac" "javac" "/usr/lib/java/jdk(version/folder)
/bin/javac" 1
Step5: export the JAVA_HOME
Open Terminal run the following command:
$ export
JAVA_HOME=/usr/lib/java/jdk(folder/version)
Done !!
Check if java installed and JAVA_HOME is
set by following command
1. $ java -version
Output :
Java version. “1.8.0_211“
………..
…..xx..x.x..x
2. $ echo $JAVA_HOME
Output /usr/lib/java/jdk
Comments
Post a Comment