Multiple Java JDK versions, Aptana Studio 3, Mac OS

277 Views Asked by At

I am having trouble running Aptana Studio 3 on a Mac where multiple versions of JDK are installed (i.e., jdk1.8.0_271.jdk and jdk-11.0.2.jdk). Aptana requires JDK 8, and when only it is in the Library/Java/JavaVirtualMachines will Aptana run, otherwise, I get startup fatal errors. I need Open JDK 11 for another application and it runs with both JDKs installed. I tried to set JDK 8 as the default in a .bash_profile using the following, but for some reason (probably an obvious one that answers this question) Aptana doesn't recognize the default setting and only runs when I remove the jdk-11.0.2.jdk from JavaVirtualMachines. I know there is a version control package jenv, but I don't have it installed, and not sure it would fix the problem anyway. Appreciate any pointers on how to resolve this, if I can/should add a shell to the package contents of Aptana, proper mods on the commands below, etc. Running Mac Mojave 10.14.6. Thanks.

export JAVA_8_HOME=$(/usr/libexec/java_home -v1.8*)

export JAVA_11_HOME=$(/usr/libexec/java_home -v11.*)

alias java8='export JAVA_HOME=$JAVA_8_HOME'

alias java11='export JAVA_HOME=$JAVA_11_HOME'

#default java8

export JAVA_HOME=$JAVA_8_HOME
1

There are 1 best solutions below

0
Oo.oO On

macOS picks the most recent version of JDK. You have few options here:

  • remove files (backup) of JDKs that you don't want to use
/Library/Java/JavaVirtualMachines/${JDK_VERSION}/Contents/Info.plist
  • make sure to setup Terminal session for using give version
# inside ~/.zshrc put

export JAVA_HOME=$(/usr/libexec/java_home -v ${VERSION_OF_YOUR_CHOICE})
export PATH=${JAVA_HOME}/bin:${PATH}
  • use some tool to maintain JDK versions

As you already mentioned, you can use some existing tool (e.g. jenv)