This website uses cookies to ensure you get the best experience. Learn More.
How to configure Liferay Developer Studio 2.2.x with Java 7 and LDS 3.x with Java 8 for Mac OS 10.13 (High Sierra)
NOTE: This scenario is also applicable to Mac OS 10.12 (Sierra).
This is possibly the simplest and least intrusive approach.
e.g.
/Applications/Liferay-Developer-Studio/Liferay-Developer-Studio-2.2.2-GA3/DeveloperStudio.app
Right click on file "DeveloperStudio.app" and select menu item "Show package contents"
/Applications/Liferay-Developer-Studio/Liferay-Developer-Studio-2.2.2-GA3/DeveloperStudio.app/Contents/MacOS
Edit Developer Studio configuration file and insert "-vm" parameter with path to Java 1.7 home folder.
e.g. FILE: /Applications/Liferay-Developer-Studio/Liferay-Developer-Studio-2.2.2-GA3/DeveloperStudio.app/Contents/MacOS/DeveloperStudio.ini
... -vm /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home ...
This configuration is only required if you plan to use the Liferay SDK from the command line console (aka. terminal).
We will configure the command line console to use Java 7 for the active user.
If you need to use a different Liferay SDK, adjust the target Java version and restart the command line console to apply changes.
if [ -f ~/.bashrc ]; then source $HOME/.bashrc fi
export JAVA_HOME=`/usr/libexec/java_home -v 1.7` export PATH=$JAVA_HOME/bin:$PATH
$ java -version java version "1.7.0_79" Java(TM) SE Runtime Environment (build 1.7.0_79-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
This approach may impact other applications or tools reliant upon a particular Java runtime, hence use with caution.
There are many articles on this topic of setting the global Java version.
Some approaches, using the java_home tool, are outlined in the following stack overflow article:
To identify all Java runtime folders on your Mac, you can use the /usr/libexec/java_home tool to identify all registered Java runtime environments e.g.
$ /usr/libexec/java_home --verbose Matching Java Virtual Machines (16): 1.8.0_171, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home 1.8.0_161, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home 1.8.0_121, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home 1.8.0_111, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home 1.8.0_45, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home 1.8.0_25, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home 1.8.0_05, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home 1.7.0_79, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home 1.7.0_71, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home 1.7.0_55, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home 1.7.0_51, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home 1.7.0_21, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home 1.6.0_51-b11-457, x86_64: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0_51-b11-457.jdk/Contents/Home 1.6.0_51-b11-457, i386: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0_51-b11-457.jdk/Contents/Home 1.6.0_35-b10-428, x86_64: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0_35-b10-428.jdk/Contents/Home 1.6.0_35-b10-428, i386: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0_35-b10-428.jdk/Contents/Home