Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Sign as root ###
- su
- ### Before you start with the setting up Java, you will need to remove the OpenJDK/JRE from the system ###
- apt-get purge openjdk-\*
- ### Check whether Ubuntu OS architecture is 32-bit or 64-bit ###
- neofetch
- ### Download the Java JDK and extract it somewhere ###
- Link: https://archive.org/details/jdk-8u301-linux-umarkovwebsite
- ### Create "java" folder in the root directory ###
- Create a folder (sign in as root first!) named "java" in the root dir and set the permission to 755 or 777.
- ### Set the permission of that "java" folder ###
- To do this: "sudo chmod -R (755 or 777) /java"
- ### Make sure you create directory as described below ###
- It will look like this: "/java/(PUT YOUR JDK FOLDER VERSION HERE)/"
- Example: "/java/jdk1.8.0_301"
- ### Add the following system variables to the end of /etc/profile file ###
- ### To do so: "nano /etc/profile" ###
- JAVA_HOME=/java/jdk1.8.0_301
- PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
- export JAVA_HOME
- export PATH
- ### Save it (ctrl+s) and exit (ctrl+x) ###
- ### Now reload the enviorment ###
- . /etc/profile
- ### Its time to let Ubuntu know where our JDK/JRE is located ###
- ### Copy-paste below lines into a command prompt ###
- update-alternatives --install "/usr/bin/java" "java" "/java/jdk1.8.0_301/bin/java" 1
- update-alternatives --install "/usr/bin/javac" "javac" "/java/jdk1.8.0_301/bin/javac" 1
- update-alternatives --install "/usr/bin/javaws" "javaws" "/java/jdk1.8.0_301/bin/javaws" 1
- ### Tell Ubuntu that our installation i.e., jdk1.8.0_05 must be the default Java ###
- update-alternatives --set java /java/jdk1.8.0_301/bin/java
- update-alternatives --set javac /java/jdk1.8.0_301/bin/javac
- update-alternatives --set javaws /java/jdk1.8.0_301/bin/javaws
- ### Test the installation using below command ###
- java -version
- ### DONE!! ###
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement