Java – understanding eclipse classpath declarations

I'm trying to understand the eclipse classpath file, especially what I want to know:

>How does JRE use it (that is, the JVM reads the XML file directly, or eclipse loads it into its internal compiler in some way)? > When I run my classes from my IDE, how do complex entries (such as the Ivy path below) resolve and merge into the JVM classloader?

Context: I have a strange mistake that eclipse is using the "wrong" version of a class, and my ivy / ant build is using the correct version, so I hope the tool eclipse can better imitate my pure class loader build To do this, I think I'll look at the eclipse project / classpath file

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="src" path="test"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="lib" path="conf"/>
    <classpathentry kind="con" path="org.apache.ivyde.eclipse.cpcontainer.ivyde_CONTAINER/?ivyXmlPath=ivy.xml&amp;confs=*"/>
    <classpathentry kind="output" path="build"/>
</classpath>

Solution

Two different things:

1) The project classpath is used to compile code using eclipse java compiler (EJC), so pass the file information to EJC

2) When you create a startup configuration, you actually declare a classpath to run the application. By default, the path is based on your project classpath This classpath is passed to the JVM as a parameter, just like manual execution (Java - CP ${classpathentries} yourmainclass) If you want to know what is the class path of startup configuration, start the application / class in debugging mode, select your process in the debugging view, and then click properties. You will see the complete class path (all jars / directories passed to the JVM as parameters)

Note: I can't see your Ivy path

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>