简体   繁体   中英

Java build path missing between Windows and OS X

I've been trying to use Eclipse to work on a Java project both in OS X and Windows, but I'm having a bit of a time with the Java build path.

If I create the project in Windows, it's missing the build path in OS X, and conversely, if I create the project in OS X, it's missing the build path in OS X.

This did happen to one of my other projects and I used this to get it working again, but it's not working this time: Eclipse - Mac Os Default JRE missing

In Windows I'm using JRE7 with Java SE 1.7 (according to the settings), on OS X I'm using Java SE 8 (1.8.0_05). I cannot for the life of me get the same build path on both without spending an hour trying to get the build path to work.

Any idea what I need to do to get the build path working on both?

Cheers Omar

This happens every time I post a question... I solve it 2 seconds after.

I installed JDK 7 for OSX, and made sure the execution environments in Eclipse matched those in Windows.

EDIT:

I found something else as well. The order that the packages are in are important. I looked at the classpath file in the project folder (it's a hidden file) and I had to make sure the order was the same. I only realised this when I committed it to Bitbucket and kept seeing the changes in the classpath file, which made me think that despite all the build paths being there, the order of which they load is important.

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v8.0">
    <attributes>
        <attribute name="owner.project.facets" value="jst.web"/>
    </attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="build/classes"/>

The JRE had to load last

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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