Specific JRE name (which might not be the same on other computers) stored in meta-data for Eclipse Ganymede WTP project

StackOverflow https://stackoverflow.com/questions/507022

  •  21-08-2019
  •  | 
  •  

Question

Problem overview:

When using Eclipse Ganymede with the Web Tools Platform the project gets dependent on the exact JRE name I use. The name might be different on other developers machines, how is this problem best solved so that many developers may work together on the project?

Detailed problem description:

I'm using Eclipse Ganymede and Web Tools Platform (as it's part of Eclipse IDE for Java EE Developers) and I have created a Dynamic Web Project.

I have a single JRE installed, the Sun JRE for Java SE 6. In Eclipse I can choose: Window / Preferences / Java / Installed JREs. And I can see a list of JRE's, each row has Name, Location and Type columns.

I only have one entry in the list, it has: Name=java-6-sun-1.6.0.07 Location=/usr/lib/jvm/java-6-sun-1.6.0.07 *Type=*Standard VM.

The problem is that the name of my JRE is specified in two Eclipse project meta-data files, they are .classpath and .settings/org.eclipse.jst.common.project.facet.core.prefs.

I want to check my project into version control for other developers to check out and work on, but I don't think that I can be sure that they have a JRE with the same exact name as I do.

Contents of the offending files:

.classpath: (The second to last classpathentry is the offending tag.)

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
        <classpathentry kind="src" path="src/main/java"/>
        <classpathentry kind="src" path="src/main/resources"/>
    <classpathentry kind="src" path="src/test/java"/>
    <classpathentry kind="con" path="org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?ivyXmlPath=ivy.xml&amp;confs=*">
        <attributes>
            <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-6-sun-1.6.0.07"/>
    <classpathentry kind="output" path="target/eclipse/classes"/>
</classpath>

.settings/org.eclipse.jst.common.project.facet.core.prefs:

#Mon Feb 02 13:29:53 CET 2009
classpath.helper/org.eclipse.jdt.launching.JRE_CONTAINER\:\:org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType\:\:java-6-sun-1.6.0.07/owners=jst.java\:6.0
eclipse.preferences.version=1

What's the best way to check in this project and let other developers check it out and run/change it?

Was it helpful?

Solution

Select the execution environment instead of the JRE to use. To do so, got to your project -> Properties -> Java Build Path -> Libraries. Select the "JRE System Library" element, click "Edit..." and select the Execution Environment of your choice (probably "JavaSE-1.6" for your example).

The .classpath file will then contain an entry like this:

<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top