Guest User

Untitled

a guest
Jul 22nd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. 1. Check the current version out of curiosity
  2.  
  3. > /usr/libexec/java_home -V
  4.  
  5. Expected result should be similar to
  6.  
  7. Matching Java Virtual Machines (2):
  8. 9.0.4, x86_64: "Java SE 9.0.4" /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home
  9. 1.8.0_162, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home
  10.  
  11. /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home
  12.  
  13.  
  14. 2. Update your .bash_profile with shortcuts to swith between versions easily:
  15. from whatever you are, go to you home dir
  16. > cd
  17. > vi .bash_profile
  18.  
  19. add lines like:
  20. alias j9="export JAVA_HOME=`/usr/libexec/java_home -v 9`; java -version"
  21. alias j8="export JAVA_HOME=`/usr/libexec/java_home -v 1.8`; java -version"
  22.  
  23. save and exit (in vi it's `:wq`)
  24. update your bash_profile with
  25.  
  26. > source .bash_profile
  27.  
  28.  
  29. 3. You are ready to go.
Add Comment
Please, Sign In to add comment