• Post Reply Bookmark Topic Watch Topic
  • New Topic

dynamic classpath  RSS feed

 
anna pillutla
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How can I add classpath dynamically?

Thanks,
Anna.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't add to the classpath of an existing class loader, but you can create your own classloader with the desired class path additions. The standard API class URLClassLoader is very convenient to use.
 
anna pillutla
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your time and reply.

Can you guide me to any examples(sample code or links) using URLClassLoader? Because I never used that class.

Anna.
[ April 18, 2005: Message edited by: anna pillutla ]
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't.
But before someone comes along to tell us, you could tell us, why you need a dynamic classpath, and perhaps we find another solution for the underlying problem?
 
anna pillutla
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to add jar files to classpath. But these jar files are created dynamically. This is the reason/need to add classpath dynamically.

Thanks,
Anna.
 
sam bos
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, if you can always load the classes in the jar file dynamically using only "custom class loader" not the current default.

You may get some idea... try this link..

http://forum.java.sun.com/thread.jspa?threadID=435579&messageID=2271560

-sam
 
sam bos
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for miss-typing ..
i mean to say "Well, You CAN always load the classes in the jar file dynamically using only "custom class loader" not the current default."
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!