dcsimg
Using Classes In A Particular Jar
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sriram_Rao
Posted On:   Sunday, June 3, 2001 11:02 PM

Hi,

I would like my program to use classes from a particular jar file irrespective of the class path in the environment in which the program is running.

For example, I would like to use package org.w3c.dom defined in a particular xerces.jar rather than picking it up from the first jar in the classpath in which it is defined (like xml.jar or jaxp.jar).

Though I found ways to load a single class from a particular jar, I was not able to find out a way of loading/using an entire package (its classes and interfaces) from a particular jar file.

I would appreciate any help in this regard.

Thanks,
Sriram

Re: Using Classes In A Particular Jar

Posted By:   Finlay_McWalter  
Posted On:   Friday, June 15, 2001 05:56 PM

You can always edit the first JAR in the classpath (e.g. rt.jar) and remove the classes you don't want. That way the system classloader will pick them up, in the normal way, from the second (or subsequent) JAR in the classpath.


It's a bit of a hack, and editing rt.jar probably breaks your licence agreement with Sun.

Re: Using Classes In A Particular Jar

Posted By:   Luigi_Viggiano  
Posted On:   Monday, June 4, 2001 04:52 AM

Hi, Java ClassLoader loads class using the classpath... If you want a different behaviour, it needs to define your own ClassLoader. Best luck,Luigi.
About | Sitemap | Contact