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

  • Links
  • <!-- #access --><!-- #masthead --><!-- #header -->

    Eclipse is running in a JRE, but a JDK is required 解决方法

    <!-- .entry-meta -->

    安装Maven后每次启动出现警告信息:

    Eclipse is running in a JRE, but a JDK is required
    Some Maven plugins may not work when importing projects or updating source folders.

    分两步解决问题:

    1. 检查Eclipse正在使用的JRE

    ‘Window’ -> ‘Preferences’ -> ‘Java’ -> ‘Installed JREs’ 确定正在使用JDK而非JRE.
    Eclipse is running in a JRE, but a JDK is required_第1张图片

    如果没有JDK, 则先新增一个Standard VM.

    2. 配置Eclipse.ini

    检查Eclipse配置文件, 增加/编辑以下代码:

    1. -vm
    2. C:\Progra~2\Java\jdk1.6.0_16\jre\bin\javaw
    -vm
    C:\Progra~2\Java\jdk1.6.0_16\jre\bin\javaw

    注意事项:

    1. 第一行参数名称, 第二行为值, 不能写到同一行中

    2. 关于第二行的值, 因为不允许出现空格, 所以使用Progra~1或2 替代”Program Files (x86)”.
    如果在Program Files下, 请使用Progra~1, 如果在x86下, 则使用Progra~2

    3. 在文件中的位置, 不能放到最后(不能在-vmargs之后), 不放心的直接放到文件最前, 如:

    1. -vm
    2. C:\Progra~2\Java\jdk1.6.0_16\jre\bin\javaw
    3. -startup
    4. .....
    5. --launcher.defaultAction
    6. openFile
    7. -vmargs
    8. -Dosgi.requiredJavaVersion=1.5
    9. -Xms240m
    10. -Xmx912m
    -vm
    C:\Progra~2\Java\jdk1.6.0_16\jre\bin\javaw
    -startup
    .....
    --launcher.defaultAction
    openFile
    -vmargs
    -Dosgi.requiredJavaVersion=1.5
    -Xms240m
    -Xmx912m

    3. 重启Eclipse, 警告不再出现.

    See: http://tech.karolzielinski.com/m2eclipse-eclipse-is-running-in-a-jre-but-a-jdk-is-required

    <!-- .entry-content -->
    This entry was posted in Java and tagged Eclipse, Java, JDK. Bookmark the permalink.
    <!-- .entry-utility -->
    <!-- #post-## --> <!-- #nav-below -->

    3 Responses to Eclipse is running in a JRE, but a JDK is required 解决方法

    1. Firm says:
      <!-- .comment-author .vcard --> <!-- .comment-meta .commentmetadata -->

      还真是麻烦。。。

      <!-- .reply -->
      <!-- #comment-## -->
    2. xinba says:
      <!-- .comment-author .vcard --> <!-- .comment-meta .commentmetadata -->

      试了好半天,不管用,直接加参数,就好了
      eclipse -vm c:\jdk1.4.2\jre\bin\javaw

      <!-- .reply -->
      <!-- #comment-## -->
    3. flysnack says:
      <!-- .comment-author .vcard --> <!-- .comment-meta .commentmetadata -->

      根据注意事项3,把代码放到最前面后,配置成功。

      <!-- .reply -->
      <!-- #comment-## -->

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *

    Name *

    Website

    Comment

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

    <!-- #respond -->
    <!-- #comments -->
    <!-- #content -->
    <!-- #container -->

    你可能感兴趣的:(eclipse)