Knowledge Base/Troubleshooting

Selecting the JDK version the IDE will run under

Serge Baranov
posted this on March 27, 2013, 16:33

Windows

JDK is bundled with all the product installers and it's recommended that you will use the provided JDK version unless there are any specific issues.

32-bit JDK is located in IDE_HOME\jre directory and is used by the 32-bit product executable.

To run the IDE in 64-bit mode you will need to download and install 64-bit JDK (not JRE) distribution and install it yourself. IDE will find and use it from the registry when you run the 64-bit .exe file (available only for IntelliJ IDEA right now, other products can use the .bat file to run in 64-bit mode).

<product>.exe uses this JDK search sequence:

  1. IDEA_JDK / WEBIDE_JDK / PYCHARM_JDK / RUBYMINE_JDK environment variable (depends on the product, WEBIDE_JDK applies to both WebStorm and PhpStorm)

  2. ..\jre directory
  3. system Registry
  4. JDK_HOME environment variable
  5. JAVA_HOME environment variable

idea64.exe uses this JDK search sequence:

  1. IDEA_JDK_64 environment variable
  2. ..\jre64 directory
  3. system Registry
  4. JDK_HOME environment variable
  5. JAVA_HOME environment variable

It’s also possible to start the IDE with <product>.bat file located in the bin directory, it uses the following JDK search sequence:

  1. IDEA_JDK / WEBIDE_JDK / PYCHARM_JDK / RUBYMINE_JDK environment variable (depends on the product)
  2. ..\jre directory
  3. JDK_HOME environment variable
  4. JAVA_HOME environment variable
Environment variable must point to the JDK installation home directory, for example:
c:\Program Files (x86)\Java\jdk1.7.0_17
  • /create-i4j-log command line switch can be used with the .exe to trace the JDK search sequence and find out why the specific JDK was chosen.
  • The actual JDK version used by the IDE can be verified in Help | About dialog (open any project to access the menu).
  • Define IDEA_JDK / WEBIDE_JDK / PYCHARM_JDK / RUBYMINE_JDK variable depending on the product to override the default version from IDE_HOME\jre.
  • Use Rapid Environment Editor to add/edit the variables, it will detect incorrect paths.

Linux

  • Refer to the distribution specific instructions for changing the default JDK version (Ubuntu Java documentation).
  • It's recommended that you will use the latest version of Oracle JDK or OpenJDK available for your system (OpenJDK 1.6 is not supported, please use 1.7 or later versions).
  • Check bin/<product>.sh file for the JDK search order, it's similar to Windows in terms of the environment variable names.
  • You can define JDK home environment variable directly in the .sh file to override system defaults.
  • Check this answer if you need to install the JDK manually on Linux.
  • Using OpenJDK is not recommended, it has known visual and performance problems that affect some users. Use on your own risk if Oracle JDK has more severe issues on your system.
  • If you have problems with ugly fonts, check this thread comments for the tips.
  • Help | About will show the actual JDK version.

Mac OS X

At the moment all our products require Apple JDK 1.6 to be installed in order to run on Mac. JDK 1.7 from Oracle is not officially supported yet and has known problems that stop us from using it by default. Oracle JDK 1.7.0_40 has added support for Retina and works much better than previous versions on Mac. You are welcome to give it a try in case you have any problems with Apple JDK.

To force running under JDK 1.7 edit /Applications/<Product>.app/Contents/Info.plist file, change JVMVersion from 1.6* to 1.7* :

<key>JVMVersion</key>
<string>1.7*</string>
  • See this answer for the known problems with JDK 1.7.
  • IDEA_JDK environment variable can be used to override the selected JDK, you may need to run the product from the Terminal so that it sees your environment variables (Mac OS limitation): open -a /Applications/<Product>.app/ .
  • Application About dialog will show the actual JDK version.

 

 

Comments

User photo
Jgc

How can I run Idea 12 with the default Java 6 VM and target code and binaries to Java 7?

August 29, 2013, 03:34
User photo
Jgc

On Mac OS X 10.8.4

August 29, 2013, 03:35
User photo
Serge Baranov
JetBrains

Project/module SDK and byte code level doesn't depend on the JDK IDEA runs under. JDK is configured for the project/module in the File | Project Structure, refer to help for details.

http://www.jetbrains.com/idea/webhelp/configuring-global-project-and-module-sdks.html
http://www.jetbrains.com/idea/webhelp/compiler-java-compiler.html

August 29, 2013, 03:37
User photo
Brentboyer

Serge: did you make a typo for the "JAVA_HOME" env var?

Note under your Windows section that the first 2 occurrences (the first two 5. items) use "JAVA HOME" (no underscore, whereas the last one (the third 4. item) uses "JAVA_HOME" (with an underscore).

"JAVA_HOME" (with an underscore) is THE universal convention, to my knowledge.  I have never seen "JAVA HOME" before, indeed, I think that that space may cause all kinds of problems.

Please confirm what is going on, and correct your original posting if needed.

 

September 16, 2013, 22:31
User photo
Serge Baranov
JetBrains

Thanks, I've fixed the typo.

September 17, 2013, 01:17
User photo
Stephen Welch

Can I change the jdk used for database connections without changing the ide  jdk version?

October 10, 2013, 13:41
User photo
Serge Baranov
JetBrains

Stephen, why do you need to change the JDK version for the database connections? It's not possible at the moment, IDE JDK is always used.

October 10, 2013, 14:53
User photo
Frj

On OSx you can define environment variables in /etc/launcd.conf (create the file if it does not exist).

The variables defined in launchd.conf will be available in Terminal and for all other processes. The downside is that changes to the file are not picked up before restarting your system.

But if you just want to set IDEA_JDK once to 1.7 (instead of changing Info.plist in every EAP install you download) it is a pretty good solution - since it allows you to launch Intellij any way you want.

 

October 24, 2013, 11:49
User photo
Frj

Doh - spelled the file name wrong - the correct name is "/etc/launchd.conf".

 

October 24, 2013, 12:41
User photo
Pbw

If you want to do this the hard way, see

http://codepulsive.blogspot.com.au/2013/05/using-environmentplist-w...

and

http://codepulsive.blogspot.com.au/2013/05/setting-environment-vari...

 

It's the way I keep my shell and GUI environment variables synchronised. Before ML it was easier, using environment.plist, but ML broke that.  The ML solution still works with Mavericks.

 

November 6, 2013, 14:00
User photo
Pbw

An easier way, that maintains synchronisation of .profile and desktop environments.

http://codepulsive.blogspot.com.au/2013/11/setting-environment-vari...

 

November 6, 2013, 21:31
User photo
Pbw

12C seems to be completely broken for La Clojure under Mavericks.  I have a small clojure test project that hangs 12C when I try to open it. I have to force close.

November 7, 2013, 02:59
User photo
Pbw

It's broader than that for me. 12C seems to hang at the 'scanning files" stage on most projects. Nasty. Thank you Apple for the constant API changes. Is there any information I can forward?  It seems that you know the way out of this, but it is just going to take some time.

November 7, 2013, 03:06
User photo
Serge Baranov
JetBrains

Please report bugs to the issue tracker and attach thread dumps/logs when it hangs.

November 7, 2013, 03:12
User photo
Pbw

I've reported the bug: IDEA-116177. In the meantime, though, I seem to have found a fix for it.  I uninstalled the new Wacom Intuous 3 drivers I installed after upgrading to Mavericks. This may be useful information for others.

November 8, 2013, 17:15
User photo
Pbw

Still hanging if I set IDEA_JDK to Java 7. On this display, I would say that Mavericks is a disgrace to its developers. It is Java-hostile to an advanced degree.

November 9, 2013, 04:14
User photo
Li Acerphoenix

hello, I installed webstorm7 and pycharm3.02 in the same time, my os is mavericks. then i change both product files in  /Applications/<Product>.app/Contents/Info.plist to jvm 1.7,

and then webstorm started successfully,but pycharm still need jdk6 to start . why?

February 1, 2014, 13:21
User photo
Serge Baranov
JetBrains

Li Acerphoenix, most likely WebStorm 7 has a more recent java launcher stub version that doesn't require JDK 1.6 to run, PyCharm 3.0.2 is built from the older platform version which still requires JDK 1.6 to be present, even if you are running under JDK 1.7. This will be resolved in the future updates.

February 1, 2014, 13:25
User photo
Tony19

After editing the plist, make sure to resign the app bundle to avoid a nagging prompt and intermittent hangs at startup. Create a code-signing cert, and then run:

   sudo codesign --verbose --force --sign "<CERT COMMON NAME>" /Applications/WebStorm.app/

I verified this with Webstorm 7.0.3 on OS X Mavericks 10.9.2.

March 16, 2014, 22:49
User photo
Hba

The IDEA_JDK variable doesn't work on Mac OSX.  But it will in will in IDEA v14: http://youtrack.jetbrains.com/issue/IDEA-123552#comment=27-739506

May 22, 2014, 17:38
User photo
Pbw

@Tony19

I have changed my JDK version to "1.8*", now that I have Oracle Java 8 installed. I haven't had nag problems after editing the plist, provided I have opened the app at least once before editing.  Admittedly, I've only opened IntelliJ a few times since the change.

June 21, 2014, 04:38
User photo
Harirao3

I edited JVMVersion in the Info.plist file for macOSX to 1.8* and on boot it does complain about early access versions and when I hit about idea it showed 1.8.0_20-ea-b22 x86_64 but when I run a maven project it shows that it is using the 1.7 version JDK  which is OK. I checked the JVMs that are available to use in the /Library/Java/JavaVirtualMachines/ directory and both 1.7x and 1.8x are available. When I enter "java -version" in the console it defaults to 1.8x. I've yet to try java8 for anything but I'm hoping on a new project i can easily use java 8 instead of java 7.

July 12, 2014, 18:53
User photo
Henrik

Harirao3: The JDK version that IntelliJ runs under is entirely unrelated to the JDK your project runs under.  To change your project JDK go to View --> Open Module Settings --> Project Settings --> Project --> Project SDK

July 14, 2014, 12:02
User photo
Harirao3

Thanks @Henrik, i actually just realized this and have fixed it accordingly! but good to have it written down for reference too

July 15, 2014, 17:32
User photo
Tommy

I just updated the info.plist on my MacBook Pro to 1.7 (1.7.0_60) and restarted intelliJ. This machine has a retina display, and the GUI became much sharper than when running with Apples 1.6! I know that Oracle did not support retina displays on Mac for 1.7 when it came, but apparently they have fixed that now. It looks really good!

August 9, 2014, 16:48
User photo
Serge Baranov
JetBrains

Laptop users, please be aware that running under JDK 1.7 or 1.8 will always enable your discrete GPU which will lead to the faster battery drain. It's a known JDK bug. If the battery life is critical for you, consider running under the recommended JDK 1.6 version. You can also try other workarounds, like the third-party gfxCardStatus utility that can forcibly disable the discrete GPU and switch to the integrated one.

October 17, 2014, 16:57
User photo
Thirumalv

@Serge Baranov: Could you update this document to reflect for Android Studio and CLion?

October 20, 2014, 08:33
User photo
Adrian Ha Bartlett

@Serge, is there any estimate on when IntelliJ will run on Java 8 for Mac? 6 Months a year?

November 29, 2014, 10:51
User photo
Serge Baranov
JetBrains

@Adrian, as soon as IntelliJ IDEA runs stable on Java 8, we'll switch to this Java version by default on Mac. There are still major issues to resolve and resolution of several issues depends on Oracle. We can't provide any estimates for Oracle, sorry. We have experimental version with bundled Java 8, see my answer here for the details how to get it.

November 29, 2014, 10:58
User photo
Pahan

Hello. I'm not shure it is right place for question, but there https://www.jetbrains.com/idea/help/configuring-global-project-and-... was been forwarded...

Is it possible run Idea say in JDK 1.7, but run/debug some for example in 1.8? It will be very desired have such per run/debug configurations settings.

 

January 2, 2015, 00:52
User photo
Serge Baranov
JetBrains

Pahan, sure. You run/debug the project with the JDK configured for the project. It can be any version, 1.6, 1.7, 1.8. You can also override the JDK per run/debug configuration. IntelliJ IDEA is very flexible, you can run IDE itself under JDK 1.8, build/run/debug with JDK 1.6 and also have specific run/debug configurations that will run/debug with 1.7 and 1.8.

January 2, 2015, 01:56
User photo
Pahan

I have found "Use alternative JRE" in f.e. for Junit run, but not for Groovy script. My initial question was about groovy so because that it looks so stupid. Sorry.

How I could doing so for run groovy scripts also?

January 4, 2015, 19:22
User photo
Serge Baranov
JetBrains

You can't do it for Groovy, request is welcome if this feature is required for your project. As this question is offtopic here, please consider contacting support or using YouTrack in case you have any other questions. Thank you.

January 4, 2015, 23:42
User photo
Pahan

@Serge thank you very much. I've request it https://youtrack.jetbrains.com/issue/IDEA-135061. And sorry for the offtopic here.

January 9, 2015, 00:02
User photo
An Anderl

@Serge: so its not possible right now to run idea 14 under java 8 on mac?

February 17, 2015, 14:43
User photo
Serge Baranov
JetBrains

An Anderl, it's possible, but not recommended with the official 1.8 JDK. You can try 14.1 EAP version with custom JDK which has many bugs fixed.

February 17, 2015, 14:45
User photo
An Anderl

Just forget my comment above :) i read it all now

February 17, 2015, 14:48
User photo
Sendi T34

How do I "open" and existing project on intellij 13.1.6  on MAC? it does not show the ij-icon for .iml/.idea folder. it only shows folder that does not tell me if this is correct folder to load project.

build: 135.1306 ultimate on mac x86_64 on macbook pro JRE/JVM hotspot 64 bit by apple

Also if it is not a correct folder for project ( from the open project menu -- where you know user is trying to open an "existing" IJ project) it creates a bad project with new .idea folder/iml file...

can you help ?

March 8, 2015, 20:21
User photo
Emmanuel Sarella

If you are using 0xDBE the path variable is dbe_JDK

March 9, 2015, 23:55
User photo
Palakmathur

Hi, 

 My JAVA_HOME is set to a Jrockit version. So, I created JDK_HOME and set it to Java 7. But when I click on idea64.exe, it is still trying to search for JAVA_HOME rather than JDK_HOME. (IDEA build 141.177).

March 31, 2015, 20:20
User photo
Serge Baranov
JetBrains

Try setting IDEA_JDK_64 instead. We have changed the launcher some time ago, so the order/variables may be a bit different.

March 31, 2015, 20:45
User photo
Jason Messmer

Trying to do this for Webstorm (10.2) 64 bit using the exe vs bat and it still looks @ JAVA_HOME.   I have set WEBIDE_JDK, WEBIDE_JDK_64, IDEA_JDK, IDEA_JDK_64 to all point to a specific version of JDK and it stills uses JAVA_HOME as the jdk.  My scenario, I have two flavors of jdk installed and JAVA_HOME is set to an older version of JDK. 

May 4, 2015, 17:00
User photo
Daniel Nienhaus

Hi there,

is Oracle JDK 1.7 still the recommended version for Linux? Or is it safe to switch to Oracle 1.8, or God forbid, OpenJDK?

Cheers!

May 6, 2015, 15:22
User photo
Serge Baranov
JetBrains

You can use 1.8 Oracle JDK or OpenJDK on Linux.

May 6, 2015, 15:23
User photo
Daniel Nienhaus

Great, thank you! Maybe the original post could be updated?

May 6, 2015, 15:26
User photo
Jim Watson

I recently began experiencing system crippling performance under PHPStorm 8.0.3. I am running Ubuntu 15.04 on a 6-core i7 processor with 16GB RAM. When indexing files all processing was assigned to a single CPU, which shot the CPU to 100%. Clearing cache and invalidating cache had no positive affect. I finally tracked this down to an apparent issue related to Java -- perhaps an update that was recently applied, not entirely sure. I had been running Java under the Oracle JDK --  Java(TM) SE Runtime Environment (build 1.8.0_45-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode). I installed OpenJDK Runtime Environment (IcedTea 2.5.5) (7u79-2.5.5-0ubuntu1) OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode) and performance is as expected. Most notably, the load of indexing is distributed evenly across all 12 CPUs.  Thought I would post this in case it helps others.



May 27, 2015, 19:48