Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### To remove OpenJDK (the one you've already installed)
- `sudo apt-get purge openjdk-\*`
- ### Make a new directory for your new JDK
- `sudo mkdir -p /usr/local/java`
- ### Copy the file to the directory (you should be in that file path)
- `sudo cp -r jdk-XuXX-linux-x64.tar.gz /usr/local/java/`
- ### Extract the file
- sudo tar xvzf jdk-XuXX-linux-x64.tar.gz
- ### You should add this to your PATH now. To do that:
- - Open `/etc/profile` : `sudo gedit /etc/profile` (**or** `/etc/environment`)
- - Scroll down (the end) and add the path where your jdk was installed
- -
- ```bash
- JAVA_HOME=/usr/local/java/jdk1.8.0_xx
- PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
- export JAVA_HOME
- export PATH
- ```
- - Save and exit
- ### Inform your Linux system where your Oracle Java JDK/JRE is located.
- - Notify the system that Oracle Java JRE is available for use
- `sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_xx/bin/java" 1`
- - Notify the system that Oracle Java JDK is available for use
- `sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.8.0_xx/bin/javac" 1`
- - Notify the system that Oracle Java Web start is available for use
- `sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.8.0_xx/bin/javaws" 1`
- ### Inform your Linux system that Oracle Java JDK/JRE must be the default Java.
- - Set the java runtime environment for the system
- `sudo update-alternatives --set java /usr/local/java/jdk1.8.0_xx/bin/java`
- - Set the javac compiler for the system
- `sudo update-alternatives --set javac /usr/local/java/jdk1.8.0_xx/bin/javac`
- - Set Java Web start for the system
- `sudo update-alternatives --set javaws /usr/local/java/jdk1.8.0_xx/bin/javaws`
- ### Reload your system wide PATH
- `source /etc/profile`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement