[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.newcomer] Re: Eclipse uses libs outdide of build path

"Philipp" <kitschen@xxxxxxxxxxxx> wrote in message 
news:gom8lo$pt7$1@xxxxxxxxxxxxxxxxxxxx
> Dear all,
> I have a Java project in my eclipse 3.3.2. In my build path libraries, I 
> have only two libs:
>
> - wre.jar : this is the JRE I want to use. It does not contain the XML 
> APIs
> - xml-apis.jar : the XML APIs from apache xml-commons
>
> In particular I have _no_ system JRE (eg. from Sun) in the build path.
>
> If I run the following code:
>
> import org.w3c.dom.Text;
> public class TextTest {
>   public static void main(String[] args) {
>     System.out.println(Text.class.getResource("Text.class"));
>   }
> }
>
> it prints out
> jar:file:/C:/Program%20Files/Java/jdk1.6.0_02/jre/lib/rt.jar!/org/w3c/dom/Text.class
>
> Why does it not get the org.w3c.dom.Text from the xml-apis.jar which is in 
> the build path, but rather from the default JRE which is installed on the 
> system?
>
> What settings should I change, so that the classes aree taken from the 
> jars in the build path?


What you're noticing is that the runtime path is different than the build 
path.

You can control the runtime path in the launch configuration settings.  For 
instance, go to the project properties and click on Run/Debug settings; edit 
your launch configuration; and go to the "JRE" tab and/or the "Classpath" 
tab.

The default is to use whatever JRE is the default JRE in the Eclipse 
preferences.