Prev: get file version
Next: NPE in Servlet
From: Lothar Kimmeringer on 20 Apr 2010 14:56 mike wrote: >>> �String resource = >>> ClassLoader.getSystemClassLoader().getResource("test.xml").toExternalForm(); >> >> Why are you using the system classloader and not the one you wrote? In >> other words, that should be cl.getResource... > > This line is used in code to access system resources. I cannot change > it. Then you need to replace the system class loader with your ClassLoader. Regards, Lothar -- Lothar Kimmeringer E-Mail: spamfang(a)kimmeringer.de PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81) Always remember: The answer is forty-two, there can only be wrong questions!
From: Lothar Kimmeringer on 20 Apr 2010 17:30 Alessio Stalla wrote: > On 20 Apr, 20:56, Lothar Kimmeringer <news200...(a)kimmeringer.de> > wrote: >> Then you need to replace the system class loader with your >> ClassLoader. > > Is it possible? <sarcasm>If there only would be something that allows to enter terms to search the web for or something like a documentation of things concerning the Java API. Oh wait!...</sarcasm> http://www.google.de/#q=replace+system+classloader+java and http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ClassLoader.html#getSystemClassLoader() should be easy to find: | If the system property "java.system.class.loader" is defined | when this method is first invoked then the value of that | property is taken to be the name of a class that will be | returned as the system class loader. The class is loaded | using the default system class loader and must define a public | constructor that takes a single parameter of type ClassLoader | which is used as the delegation parent. An instance is then | created using this constructor with the default system class | loader as the parameter. The resulting class loader is defined | to be the system class loader. Regards, Lothar -- Lothar Kimmeringer E-Mail: spamfang(a)kimmeringer.de PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81) Always remember: The answer is forty-two, there can only be wrong questions!
|
Pages: 1 Prev: get file version Next: NPE in Servlet |