Eclipse 中的 Maven 项目 - 也许您运行的是 JRE 而不是 JDK
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30777478/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Maven project in Eclipse - Perhaps you are running on JRE rather than JDK
提问by user3097712
I have the same problem as in the post: No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
我和帖子里有同样的问题:在这个环境中没有提供编译器。也许您在 JRE 而不是 JDK 上运行?
I follow the steps of the first comment in that post. But I can not find a JDK folder. To illustrate this I add a picture how it looks like:
我按照该帖子中第一条评论的步骤进行操作。但是我找不到JDK文件夹。为了说明这一点,我添加了一张图片:
So, as you can see, I have no jdk- folder . And I would like to know, why? And what to do? When I run "clean install" from the command line, then everything is okay. In Eclipse, I get the message that I run perhaps on JRE instead of JDK.
因此,如您所见,我没有 jdk- 文件夹。我想知道,为什么?怎么办?当我从命令行运行“全新安装”时,一切正常。在 Eclipse 中,我收到消息说我可能在 JRE 而不是 JDK 上运行。
edit: I have also installed the jdk folder. Here again, a picture:
编辑:我还安装了 jdk 文件夹。再来一张图:
回答by TinyOS
I have make for you the the various steps to follow to specify the JDK to use with Eclipse. Of course you can make more than one JDK then in the build path for any project You can specify the JRE.
我已经为您提供了指定要与 Eclipse 一起使用的 JDK 的各个步骤。当然你可以制作多个JDK然后在任何项目的构建路径中你可以指定JRE。
Here is same Screen shots:
这是相同的屏幕截图:
Step1:
第1步:
Step 2:
第2步:
Step 3
第 3 步
:
:
回答by greg-449
You must tell Eclipse the location of the JDK you want it to use.
您必须告诉 Eclipse 您希望它使用的 JDK 的位置。
You do this in the Preferences on the 'Java > Installed JREs' page. If the JDK is not shown there click the 'Add...' button. Choose the type of JRE/JDK (normally 'Standard VM' except on a Mac). On the next page enter the directory containing the JDK.
您可以在“Java > 已安装 JRE”页面上的首选项中执行此操作。如果未显示 JDK,请单击“添加...”按钮。选择 JRE/JDK 的类型(通常为“标准 VM”,Mac 除外)。在下一页输入包含 JDK 的目录。
Once you have entered the JDK location it will show in the list on the Installed JREs page. Click OK to close the Preferences and save this list. You can then open the Preferences again and the JDK should now be shown in the Execution Environments page.
输入 JDK 位置后,它将显示在已安装 JRE 页面的列表中。单击确定关闭首选项并保存此列表。然后您可以再次打开 Preferences,JDK 现在应该显示在 Execution Environments 页面中。
回答by virakti jain
Perhaps your java_home variable is set to use jre rather than jdk. Change your java_home variable as 'C:\Program Files\Java\jdk1.8.0_25' accordingly. Also jdk_home variable as 'C:\Program Files\Java\jdk1.8.0_25'.
也许您的 java_home 变量设置为使用 jre 而不是 jdk。相应地将 java_home 变量更改为 'C:\Program Files\Java\jdk1.8.0_25'。jdk_home 变量也为“C:\Program Files\Java\jdk1.8.0_25”。