Advertisement
Justman10000

Manage Java

Feb 23rd, 2023 (edited)
1,641
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.62 KB | None | 0 0
  1. // To install java
  2. version=21 # Choose between 17 and 21
  3. underversion=21.0.2 # Choose between 21.0.2 and 17.0.9
  4. os=_linux
  5.  
  6. wget https://download.oracle.com/java/$version/latest/jdk-$version$os-x64_bin.tar.gz
  7. gunzip jdk-$version$os-x64_bin.tar.gz
  8. tar xvf jdk-$version$os-x64_bin.tar
  9. mv jdk-$underversion /usr/local/java
  10. ln -fs /usr/local/java/bin/java /usr/bin
  11. ln -fs /usr/local/java/bin/javac /usr/bin
  12. ln -fs /usr/local/java/bin/jar /usr/bin
  13. rm -r *.tar
  14.  
  15. # To check java is installed correctly
  16. java -version
  17.  
  18. // To uninstall java
  19. rm -r /usr/local/java
  20. rm -r /usr/bin/java
  21. rm -r /usr/bin/javac
  22. rm -r /usr/bin/jar
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement