Wednesday, October 19, 2011

Running IDEA on Windows 64bit JVM

For reasons unknown the Windows download for IntelliJ IDEA defaults to running in a 32bit JRE that comes as part of the distribution. This is particularly annoying on Windows since the 32bit JVM is limited to roughly a gigabyte and a half of heap space.

To run IDEA with an arbitrary JVM the "JDK_HOME" environment variable needs to be set (not "JAVA_HOME"). Then IDEA can be started with the "idea.bat" file in the "bin" directory of the installation.

By default the batch file will leave an extra console window around. This can be avoided by (a) changing from the java.exe executable to the javaw.exe (just add that extra w where the JAVA_EXE is configured) and (b) adding the "start" command in front of the actual call to java.

Note that start assumes that the first quoted parameter is a window name, not a command. That means you need one more quoted parameter in front with arbitrary content. The full line in my file (IDEA 10.5.2) looks like this:

start "" "%JAVA_EXE%" %JVM_ARGS% -cp "%CLASS_PATH%" %IDEA_MAIN_CLASS_NAME% %*