简体   繁体   English

如何在Eclipse中运行Java应用

[英]how to run java app in eclipse

I've already installed JDK and JRE and I created a project, tried to build an application and encountered an error: 我已经安装了JDK和JRE,并创建了一个项目,尝试构建应用程序并遇到错误:

"no compiler is configured and need to check JDK" “未配置编译器,需要检查JDK”

So I went to Windows/Preference/Java as follows, but I can't find JDK. 因此,我按照以下说明去过Windows / Preference / Java,但是找不到JDK。

How can I solve this issue? 我该如何解决这个问题?

在此处输入图片说明

Well if you did download and isntall the newest JDK (NOT JRE) then you should be able to find id on your system. 好吧,如果您确实下载并安装了最新的JDK(NOT JRE),那么您应该能够在系统上找到ID。 Check your operating system for the right version (32 bit or 64 bit).. 检查操作系统的正确版本(32位或64位)。

After that in Eclipse under Window/Preferences/Java/Insalled JREs you can add the JDK definition you installed and want to use. 之后,在Eclipse中的Window / Preferences / Java / Insalled JRE下,您可以添加已安装并要使用的JDK定义。 Just click on the Add button and add it, don't forget to check it as the default, then Apply! 只需单击“添加”按钮并添加它,别忘了将其检查为默认值,然后单击“应用”!

If you go then to your project, right click it, go to Build Path/Configure Build Path, under the tabb Libraries you should see your selected JDK version as System Library. 如果您随后转到项目,请右键单击它,转到“构建路径/配置构建路径”,在选项卡“库”下,您应该将所选的JDK版本视为“系统库”。

Under Java Compiler you can check the Compiler coplience level: Eclipse Mars has 1.8 as Default eg 在Java编译器下,您可以检查编译器的兼容级别:Eclipse Mars的默认值为1.8,例如

Hope this helps you to set up your Eclipse.. 希望这可以帮助您设置Eclipse。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM