Friday, September 3, 2010

Eclipse is running in a JRE, but a JDK is required

Problem:
After I install m2eclipse plugin, every time I launch eclipse IDE, I get an alert saying "Eclipse is running in a JRE, but a JDK is required".

Root Cause:
Maven needs some jar files from JDK distribution.

Solution:
Add -vm  option to eclipse.ini before -vmargs option.

Here is copy of my eclipse.ini (Windows OS, Eclipse 3.4.1)
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256M
-framework
plugins\org.eclipse.osgi_3.4.2.R34x_v20080826-1230.jar
-vm
C:\Program Files\Java\jdk1.6.0_20\jre\bin\client\jvm.dll

-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
Notes:
  1. The -vm option must come before the -vmargs, since everything after -vmargs is passed to the JVM instead of Eclipse
  2. The -vm option and its value (the path to the JVM) must be on separate lines.
  3. The path to the JVM can be to java.exe, javaw.exe or jvm.dll per Eclipse wiki page, but my test shows jvm.dll works.
  4. If the path with white space (e.g. C:\Program Files) cannot work, double quote the path.
  5. I also set -vmargs option in Eclipse start up command line (e.g. C:\Workshop\eclipse\eclipse.exe  -clean -showlocation WAPI2.0 -refresh -vmargs -Xms256M -Xmx384M)
Reference:
http://wiki.eclipse.org/Eclipse.ini

1 comment:

  1. G:\study\eclipse-jee-galileo-SR2-win32\eclipse\eclipse.exe -vm "E:\Program Files\Java\jdk1.6.0_23\bin\javaw.exe"

    This works fine. :)

    Regards,
    Anadi KUMAR
    Architecture and R2ds, Channels and Framework, Software Engineer | HSBC Technology and Services - Global Technology
    HSBC Software Development (India)Limited
    GLT 4.0 - Panchshil Tech. Park, Block D, S.No. 19, Hissa 2A/11/2, Yerawada, Pune, 411006.
    India.

    Mobile. +91 9822622054
    Email. anadikumar@hsbc.co.in
    Email. anadikumar@gmail.com

    ReplyDelete