Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2006

Tip: Looking for answers? Try searching our database.

Setting classpath at runtime?

Thread view: 
L Clarke - 16 Feb 2006 20:11 GMT
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
Oliver Wong - 16 Feb 2006 20:44 GMT
> Hi,
>
[quoted text clipped - 4 lines]
> 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
Thomas Kellerer - 16 Feb 2006 22:30 GMT
L Clarke wrote on 16.02.2006 21:11:
> Hi,
>
[quoted text clipped - 3 lines]
> 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
Roedy Green - 17 Feb 2006 05:08 GMT
>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?
see http://mindprod.com/jgloss/classloader.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Stephen - 17 Feb 2006 10:42 GMT
System.setProperties() will not work.
try URLClassLoader

--
Regards;
Stephen


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.