SHARE
TWEET

Installing OpenJDK11 on Mac

hackworks Jun 30th, 2020 (edited) 973 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 existing JAVA_HOME
  23. echo $JAVA_HOME
  24.  
  25. # Check if everything works
  26. jenv shell 11
  27.  
  28. # Set JAVA_HOME in shell
  29. export JAVA_HOME=$(dirname $(dirname $(jenv which javac)))
  30.  
  31. # Print JAVA_HOME
  32. echo $JAVA_HOME
  33.  
  34. # Check the Java version
  35. java -version
  36. # openjdk 11.0.7 2020-04-14
  37. # OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.7+10)
  38. # OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.7+10, mixed mode)
  39.  
  40. # Check Java compiler version
  41. javac -version
  42. # javac 11.0.7
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top