Java Hacks: Make a Java version installed in macOS NOT accessible system wide

To make a Java version not accessible system wide in macOS i.e. to make it only invocable from the terminal:

  • Go to /Library/Java/JavaVirtualMachines and then inside specific JDK directory
  • Inside /Contents rename Info.plist to Info.plist.disabled
  • Restart the system

Ref: https://stackoverflow.com/questions/21964709/how-to-set-or-change-the-default-java-jdk-version-on-os-x

This is useful if you want to run an application in macOS that needs for e.g. Java 8 but you have a later version installed (Java 15) which is the system default. Above workaround helps to override the system default Java version in macOS. Personally, this technique helped me to run Mulesoft Anypoint Platform which needs Java 8 even though I had higher version of Java installed in my system.

Leave a comment