开发者

Project fails to build in Eclipse under Mac

开发者 https://www.devze.com 2023-04-05 20:35 出处:网络
So, I finally figured out how to update Java in Mac and managed to get my class with a SwingWorker work; previously, Java was complaining because I had Java 1.5 and 1.5 does not have SwingWorker. I wa

So, I finally figured out how to update Java in Mac and managed to get my class with a SwingWorker work; previously, Java was complaining because I had Java 1.5 and 1.5 does not have SwingWorker. I wasn't able to change the default JRE in Mac though; I just linked the JRE 6 library in Eclipse so I can build. It is now happy even in the presence of 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 'Pr开发者_运维百科ojectName'.
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 (e.g. classes compiled with Java 6 can be incompatible with Java 5 because of different byte code version).

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. If not, add it as a Mac OSX VM. This has to be done manually, as Eclipse does not look for additional VMs after the first launch.

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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消