Setting the JDK for the Eclipse IDE

By Jim

I am a confirmed intelliJ user for Java programming, but I have been dabbling with eclipse recently.  I’m mainly interested in it due to SpringSource’s Tool Suite and also the Scala eclipse plugin.  I’m using the preconfigured sts builds from SpringSource’s website, which includes several plugins including Maven Integration.  These plugins require access to a JDK (as opposed to the JRE) which is not configured by default.  Starting eclipse will launch a warning of the problem:

“The Maven Integration requires that Eclipse be running in a JDK, because a number of Maven core plugins are using jars from the JDK. Please make sure the -vm option in eclipse.ini is pointing to a JDK and verify that Installed JRE’s are also using JDK installs.”

eclipse_ini_warning

This is very good advice, but it is lacking in that it doesn’t explain how to modify the eclipse.ini to accomplish this purpose.  I was surprised at the amount of searching required to find the answer, so I’m posting my findings.

The eclipse.ini file is located in the base eclipse directory.  On linux, you’ll want to specify the complete path to javaw.exe.  Here is a copy of my file (with SpringSource customizations):

-showsplash
com.springsource.sts
–launcher.XXMaxPermSize
256M
-framework
plugins\org.eclipse.osgi_3.4.

3.R34x_v20081215-1030.jar
-vm
C:\Java\jdk1.6.0_13\bin\javaw.exe

-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx768m
-XX:MaxPermSize=256m

Tags: , ,

4 Responses to “Setting the JDK for the Eclipse IDE”

  1. Fletch Says:

    Thanks. On windows I put in -vm “%JAVA_HOME%” and it seems to have worked.

  2. Fletch Says:

    Wait – I take that back. Doesn’t work. In fact no matter what I do it doesn’t seem to work.

    • Jim Says:

      Bummer! The example above worked on my Windows machine. After specifying the full path to javaw.exe, did you still receive the Maven integration warning?

  3. openvn Says:

    -to Jim : thank very much.
    -to Fletch : i think you should add -vm option in order like example.I had problem like you,so i try to reorder and it work,if need you can read more here : http://wiki.eclipse.org/Eclipse.ini .good luck to you.

Leave a Reply