Advertisement
mechanicker

Installing OpenJDK11 on Mac

Jun 30th, 2020
1,205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.10 KB | None | 0 0
  1. # Every line with '#' is a comment, do not run. Run only commands that do not start with '#'
  2.  
  3. # Install homebrew to install and manage software on Mac
  4. /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  5.  
  6. # Update and install all default software before installing Java
  7. brew update
  8. brew upgrade
  9.  
  10. # Let us install OpenJDK - tell brew the location
  11. brew tap AdoptOpenJDK/openjdk
  12.  
  13. # Install OpenJDK11
  14. brew cask install adoptopenjdk11
  15.  
  16. # Let us install an easy tool to manage different Java versions
  17. brew install jenv
  18.  
  19. # Register OpenJDK11 in jenv
  20. jenv add /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
  21.  
  22. # Check if everything works
  23. jenv shell 11
  24.  
  25. # Set JAVA_HOME in shell
  26. export JAVA_HOME=$(dirname $(dirname $(jenv which javac)))
  27.  
  28. # Print JAVA_HOME
  29. echo $JAVA_HOME
  30.  
  31. # Check the Java version
  32. java --version
  33. # openjdk 11.0.7 2020-04-14
  34. # OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.7+10)
  35. # OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.7+10, mixed mode)
  36.  
  37. # Check Java compiler version
  38. javac --version
  39. # javac 11.0.7
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement