Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. ### To remove OpenJDK (the one you've already installed)
  2. `sudo apt-get purge openjdk-\*`
  3.  
  4. ### Make a new directory for your new JDK
  5. `sudo mkdir -p /usr/local/java`
  6.  
  7. ### Copy the file to the directory (you should be in that file path)
  8. `sudo cp -r jdk-XuXX-linux-x64.tar.gz /usr/local/java/`
  9.  
  10. ### Extract the file
  11. sudo tar xvzf jdk-XuXX-linux-x64.tar.gz
  12.  
  13. ### You should add this to your PATH now. To do that:
  14. - Open `/etc/profile` : `sudo gedit /etc/profile` (**or** `/etc/environment`)
  15. - Scroll down (the end) and add the path where your jdk was installed
  16. -
  17. ```bash
  18. JAVA_HOME=/usr/local/java/jdk1.8.0_xx
  19. PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
  20. export JAVA_HOME
  21. export PATH
  22. ```
  23. - Save and exit
  24.  
  25. ### Inform your Linux system where your Oracle Java JDK/JRE is located.
  26. - Notify the system that Oracle Java JRE is available for use
  27. `sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_xx/bin/java" 1`
  28.  
  29. - Notify the system that Oracle Java JDK is available for use
  30. `sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.8.0_xx/bin/javac" 1`
  31.  
  32. - Notify the system that Oracle Java Web start is available for use
  33. `sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.8.0_xx/bin/javaws" 1`
  34.  
  35. ### Inform your Linux system that Oracle Java JDK/JRE must be the default Java.
  36. - Set the java runtime environment for the system
  37. `sudo update-alternatives --set java /usr/local/java/jdk1.8.0_xx/bin/java`
  38.  
  39. - Set the javac compiler for the system
  40. `sudo update-alternatives --set javac /usr/local/java/jdk1.8.0_xx/bin/javac`
  41.  
  42. - Set Java Web start for the system
  43. `sudo update-alternatives --set javaws /usr/local/java/jdk1.8.0_xx/bin/javaws`
  44. ### Reload your system wide PATH
  45. `source /etc/profile`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement