Loading a JAR file from a URL - more

M

MJK

In my original message, I asked:

"I am loading a JAR file from a URL. It loads OK. What I want to do,
is use the classes defined in the JAR file as if they were loaded from
the CLASSPATH. Does anyone know if this is possible?"

I have successfully loaded the JAR file, and even done:
'loadClass("com.nmr.MyClass")', and the class gets loaded, and I can
do a 'newInstance'.

But, when I refer to class: com.nmr.MyClass, I get a
ClassNotFoundException.

How can I load the JAR file in such a way that I can refer to the
classes in the JAR file as if they were loaded from the CLASSPATH?
 
A

Andrew Thompson

On 28 Sep 2004 06:53:11 -0700, MJK wrote:

Please do not change the subject of your posts MJK..
In my original message,

Which, for reference, can be seen here..
<http://google.com/[email protected]>

But, when I refer to class: com.nmr.MyClass, I get a
ClassNotFoundException.

How are you referring to them?
<http://www.physci.org/codes/sscce.jsp>

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.lensescapes.com/ Images that escape the mundane
 
J

John K

You cannot refer to the classes in your source code unless you have
that JAR on the classpath for the compilation step.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top