Search This Blog

Set Java Home on Mac OS

  • To check currently installed Java VMs:
    /usr/libexec/java_home -V
  • To set JAVA_HOME for terminal applications:
    export JAVA_HOME=`/usr/libexec/java_home`
    or if you want to set to use a specific version of Java VM, just specify its full path:
    export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home
  • To set JAVA_HOME for graphical applications (Finder via Jar Launcher.app):
    launchctl setenv JAVA_HOME `/usr/libexec/java_home`
    or if you want to set to use a specific version of Java VM, just specify its full path:
    launchctl setenv JAVA_HOME /Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home

No comments:

Post a Comment