• 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

How Add new classess to the System Classs loader.

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to develope a jsp page which should take a JAR file as an input and then add all the classess in that jar to to the System Class Loader. it should be such that once loaded these classess should be availabele to the whole system wihout needing to load the classess from the jar.

I have created a URLClassLoader

public static URLClassLoader getURLClassLoader(URL jarURL) {
return new URLClassLoader(new URL[] { jarURL }, ExternalJarUtils.class.getClassLoader());}
=========================================================
and here i am loadining the class.
------------------------------------
urlLoader = ExternalJarUtils.getURLClassLoader(new URL("file",url, jarName));
aClass = Class.forName(jobClass, true, urlLoader);
========================================

The PROBLEM IS EVERY TIME I NEED THIS CLASS I HAVE TO READ THE JAR. which is not possible in my sitiution.

I will really appriciate any help regarding this.
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

I am afraid your question is too difficult for "beginning Java", soI shall move it.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic