Setting classpath at runtime?

L

L Clarke

Hi,

I want to set the classpath at runtime, is there a method that aloows
setting/altering (or adding to) the classpath variable at runtime from code?

thanks in advance
lee
 
O

Oliver Wong

L Clarke said:
Hi,

I want to set the classpath at runtime, is there a method that aloows
setting/altering (or adding to) the classpath variable at runtime from
code?

thanks in advance
lee

You could try System.setProperties(); but it sounds like your question
is too low-level (see
http://www.catb.org/~esr/faqs/smart-questions.html#goal) If your goal is to
change where the JVM searches for loading classes, you may be better off
writing a custom class loader.

- Oliver
 
T

Thomas Kellerer

L Clarke wrote on 16.02.2006 21:11:
Hi,

I want to set the classpath at runtime, is there a method that aloows
setting/altering (or adding to) the classpath variable at runtime from code?

thanks in advance
lee

You will need to use your own classloader. Have a look at URLClassLoader which
will probably do what you want to (load classes from jar files not present in
the classpath at JVM startup I assume)

Thomas
 

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

No members online now.

Forum statistics

Threads
474,262
Messages
2,571,045
Members
48,769
Latest member
Clifft

Latest Threads

Top