简体   繁体   English

Mac上的Eclipse无法建立专案

[英]Project fails to build in Eclipse under Mac

So, I finally figured out how to update Java in Mac and managed to get my class with a SwingWorker work; 因此,我终于找到了如何在Mac中更新Java的方法,并设法通过SwingWorker来完成我的课程。 previously, Java was complaining because I had Java 1.5 and 1.5 does not have SwingWorker. 以前,Java一直在抱怨,因为我有Java 1.5,而Java 1.5没有SwingWorker。 I wasn't able to change the default JRE in Mac though; 但是我无法在Mac中更改默认的JRE。 I just linked the JRE 6 library in Eclipse so I can build. 我只是在Eclipse中链接了JRE 6库,所以可以进行构建。 It is now happy even in the presence of SwingWorker. 现在,即使在SwingWorker在场的情况下,它也很高兴。

However, when I try to build my project, I get the following error: 但是,当我尝试构建项目时,出现以下错误:

Errors occurred during the build.
Errors running builder 'Integrated External Tool Builder' on project 'ProjectName'.
Exception occurred executing command line.
/Users/lab/Documents/workspace/ProjectName/.project: cannot execute
Exception occurred executing command line.
/Users/lab/Documents/workspace/ProjectName/.project: cannot execute

Anyone knows this error? 有人知道这个错误吗? I've tried cleaning the project then building again but to no avail. 我试过清理项目,然后再次构建,但无济于事。 Any suggestions? 有什么建议么?

Thanks! 谢谢!

As you said, you did not manage to set the default JRE version in Eclipse - this might be a problem, as simply adding the Java 6 libs might not work (eg classes compiled with Java 6 can be incompatible with Java 5 because of different byte code version). 如您所说,您没有设法在Eclipse中设置默认的JRE版本-这可能是一个问题,因为仅添加Java 6库可能不起作用(例如,由于字节不同,用Java 6编译的类可能与Java 5不兼容。代码版本)。

First of all, open Preferences, and go to the Java/Installed JRE's page, and make sure that the newly installed Java 6 is available here. 首先,打开“首选项”,然后转到Java / Installed JRE页面,并确保新安装的Java 6在此处可用。 If not, add it as a Mac OSX VM. 如果不是,请将其添加为Mac OSX VM。 This has to be done manually, as Eclipse does not look for additional VMs after the first launch. 这必须手动完成,因为Eclipse在首次启动后不会寻找其他VM。

After the JRE is installed, update your project settings: right click on your project, select Properties, and in the Java build path page make sure that Java 6 is set as the JVM on the build tab - if not, then edit the entry, and select a Java VM 6 execution environment. 安装JRE之后,更新您的项目设置:右键单击您的项目,选择Properties,然后在Java build path页面中确保Java 6在build选项卡上设置为JVM-如果没有,则编辑条目,并选择一个Java VM 6执行环境。

Finally (this step might not be needed), open the Run configuration, (Run/Run configurations... in menu), select your projects configuration, and on the main page make sure, that for runtime also a Java SE 6 VM or execution environment is selected. 最后(可能不需要此步骤),打开运行配置,(在菜单中运行/运行配置...),选择您的项目配置,并在主页上确保对于运行时,Java SE 6 VM或选择执行环境。

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

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