« Back

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)

Technical Blogs May 24, 2018 By Tim Telcik


  • You are hosting Liferay Developer Studio with Mac OS 10.13 (High Sierra)
  • You want to use Liferay Developer Studio 2.2.x with Java 7 and Liferay Developer Studio 3.x with Java 8
  • Liferay Developer Studio 2.2.x requires Java 1.7 (7)
  • Liferay Developer Studio 3.x requires Java 1.8 (8)
  • You have Java 1.7 (7) and 1.8 (8) installed on your Mac
  • Java 1.8 (8) is the default Java runtime on your Mac

NOTE: This scenario is also applicable to Mac OS 10.12 (Sierra).

Solution Outline

  • Configure Liferay Developer Studio 2.2.x to use Java 7
    NOTE: Do not configure Liferay Developer Studio 3.x as it will default to using Java 8
  • Configure console to use Java 7 for user profile (optional)
  • Configure Java 7 as the system-wide default for Mac OS (optional)


1. Liferay Developer Studio 2.2.x Configuration

This is possibly the simplest and least intrusive approach.

1.1. Locate LDS 2.2.x app using Mac OS Finder



1.2. Show package contents

Right click on file "DeveloperStudio.app" and select menu item "Show package contents"



1.3. Update LDS 2.2 app launch configuration with path to Java 1.7

Edit Developer Studio configuration file and insert "-vm" parameter with path to Java 1.7 home folder.


FILE: /Applications/Liferay-Developer-Studio/Liferay-Developer-Studio-2.2.2-GA3/DeveloperStudio.app/Contents/MacOS/DeveloperStudio.ini


2. Mac OS 10.13 (High Sierra) User Profile Java Console Configuration (Optional)

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.

2.1/ Create or update file $HOME/.bash_profile with the following snippet.


if [ -f ~/.bashrc ]; then
   source $HOME/.bashrc

2.2/ Create or update file $HOME/.bashrc with the following snippet


export JAVA_HOME=`/usr/libexec/java_home -v 1.7`

export PATH=$JAVA_HOME/bin:$PATH

3/ Close and reopen all console (aka. terminal) windows to apply changes

4/ Confirm command line console is using Java version 1.7


$ 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)


3. Mac OS 10.13 (High Sierra) Global Java Configuration (Optional)

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


$ /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

Related Articles

Threaded Replies Author Date
[...] Hello Ruben and Frank, you can have... Anonymous June 4, 2018 4:07 PM

[...] Hello Ruben and Frank, you can have multiple Java runtime environments on your Mac. I am hosting LDS 2.2.x with Java 7 and LDS 3.x with Java 8 on my Mac running Mac OS 10.13 (High Sierra). I have... [...] Read More
Posted on 6/4/18 4:07 PM.