• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

setting classpath dynamically

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear friends,
The System.setProperty() allows the setting of the classpath at runtime on my local machine from an application. But I see that the classes are not loaded from them and ClassNotFounfException occurs. Is it that the classpath path at app load time is only considered ? Then why should they allow for setting the classpath property. I would loke to know if the above task could be done without using a custom classloader ?
Thanks
 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have not found a way to set the classpath dynamically. However you don't have to use a custom classloader. The URLClassloader works just fine for this purpose. Here is some code I use to call some classes that are installed on Mac OS X but are not in the classpath for some reason:

All that to replace the commented out line that begins with //success =
[ April 11, 2002: Message edited by: Steve Deadsea ]
 
Sandeep Lakshmipathy
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks
That was of help to me. It did the job.
Bye
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thnx alot! I've been using XStream in conjunction with the Classloader and the classes that i loaded were situated in a .war file (i'm working with the j2ee architecture), after deploying an ejb file aswell the default classloader pointed to the wrong jar and thus i'm using the URLClassloader now.
 
We don't have time for this. We've gotta save the moon! Or check this out:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic