Loading Resources from a .JAR

I've read through this forum and searched java.sun.com and have found nothing to solve my problem, although I see many other people are having the same problem.
I wrote a small application that needs to load a text file and images. When I just compile everything and then run it, all is well, my text file is found and my images are displayed. Now the problem is when I package everything into a .JAR file, suddenly my magic stops. Here is the directory structure
- State.class
FiftyStatesGame.class
FlagPanel.class
StatsPanel.class
StatePanel.class
states.txt
/images
/flags
a bunch of .gif images (50 total)
/states
a bunch of .gif images (50 total)
I create my archive with the following command
jar cvf FiftyStates.jar *
and all seems well, I've even changed the extension to .zip to ensure that the images and text file is inside the jar
Now when I try to run the program using
java -cp FiftyStates.jar FiftyStatesGame
the program starts but I get a NullPointerException and my pictures don't load. :-(
I've read in the forum about using
URL imageURL = ClassLoader.getSystemResource(<path to image>);
Image logo = Toolkit.getDefaultToolkit().getImage(imageURL);
and I tried this and once again, it works when not in jar form, but as soon as the application is JARed, I encounter the same problems.
Can anyone give me the answer to this crazy problem?
and I guess I should go one step further and ask, if I want to give this program to a friend with the JRE installed on a windows machine, what command should I put in my batch file to run this program on his machine?
javaw -cp FiftyStates.jar FiftyStatesGame
Thanks for any help and advice

Hi,
Getting the image
=================
It seems to me you can't be too far away from resolving your problem.
I've never actually tried to get an image from a jar file, so I'm guessing that this may not work for you, but I have unzipped a zip file contained within an executable jar.
What I did was this:
    private ZipInputStream findInstallationFile() {
        ClassLoader classLoader;
        URL url;
        ZipInputStream zipInputStream = null;
        InputStream inputStream;
        classLoader = getClass().getClassLoader();
        url = classLoader.getResource(ZIP_RESOURCE_NAME);
        if (url != null) {
            try {
                inputStream = url.openStream();
                zipInputStream = new ZipInputStream(inputStream);
            } catch (IOException ioe) {
                ioe.printStackTrace();
        } else {
            System.err.println("Failed to find resource: " + ZIP_RESOURCE_NAME);
        return zipInputStream;
    }The good thing about this is that you can see whether or not the resource was found in the jar file. If the returned URL is null, then the resource isn't there.
Once you have the InputStream, you can just read the entire contents and do what you like with them.
Executable jars
===============
You can make it easier to run a jar file by including a manifest file. This is just a text file which should be in the META-INF directory in your jar file. The manifest file itself should be called Manifest.mf.
The contents of the Manifest should be:
Manifest-Version: 1.0
Main-Class: FiftyStatesGame
This assumes that your main class is FiftyStatesGame which is in the default package (tut, tut!).
Hope this helps!
Rhys

Similar Messages

  • Loading resources from jar - problem

    I've got a problem when loading resources from jar.
    My code:
    package game.player;
    import javax.swing.ImageIcon;
    import java.awt.Image;
    import game.map.Map;
    import game.map.MapReader;
    import game.emptyclass.EmptyClass;
    import java.net.URL;
    public class Data
        ClassLoader cl = EmptyClass.class.getClassLoader();
        Image image1 = new ImageIcon(cl.getResource("data/sprites/man6.png")).getImage();
        Image image2 = new ImageIcon(cl.getResource("data/sprites/man5.png")).getImage();
        Image image3 = new ImageIcon(cl.getResource("data/sprites/man4.png")).getImage();
        Image image4 = new ImageIcon(cl.getResource("data/sprites/man3.png")).getImage();
        Image image5 = new ImageIcon(cl.getResource("data/sprites/man2.png")).getImage();
        Image image6 = new ImageIcon(cl.getResource("data/sprites/man1.png")).getImage();
        public Image tile1 = new ImageIcon(cl.getResource("data/maps/test/tile1.png")).getImage();
        public Image bg = new ImageIcon(cl.getResource("data/maps/default/bg.png")).getImage();
        public Map map = new MapReader(cl.getResource("data/maps/test/test.map").getPath()).getMap();
        public int getImageWidth()
            return image1.getWidth(null);
        public int getImageHeight()
            return image1.getHeight(null);
    }I get a NullPointerException.
    Thanks in advance!

    Hi ,
    getResource() method argument is not begin with the
    character '/' , ex.
    Image image1 = new
    ImageIcon(cl.getResource("/data/sprites/man6.png")).ge
    tImage();
    I thought of that, but it's not applicable here because getResource is being called on the ClassLoader, not the Class.

  • Issues with Loading Images from a Jar File

    This code snippet basically loops through a jar of gifs and loads them into a hashmap to be used later. The images all load into the HashMap just fine, I tested and made sure their widths and heights were changing as well as the buffer size from gif to gif. The problem comes in when some of the images are loaded to be painted they are incomplete it looks as though part of the image came through but not all of it, while other images look just fine. The old way in which we loaded the graphics didn't involve getting them from a jar file. My question is, is this a common problem with loading images from a jar from an applet? For a while I had tried to approach the problem by getting the URL of the image in a jar and passing that into the toolkit and creating the image that way, I was unsuccessful in getting that to work.
    //app is the Japplet
    MediaTracker tracker = new MediaTracker(app);
    //jf represents the jar file obj, enum for looping through jar entries
    Enumeration e = jf.entries();
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    //buffer for reading image stream
    byte buffer [];
    while(e.hasMoreElements())
    fileName = e.nextElement().toString();
    InputStream inputstream = jf.getInputStream(jf.getEntry(fileName));
    buffer = new byte[inputstream.available()];
    inputstream.read(buffer);
    currentIm = toolkit.createImage(buffer);
    tracker.addImage(currentIm, 0);
    tracker.waitForAll();
    images.put(fileName.substring(0, fileName.indexOf(".")), currentIm);
    } //while
    }//try
    catch(Exception e)
    e.printStackTrace();
    }

    compressed files are not the problem. It is just the problem of the read not returning all the bytes. Here is a working implementation:
    InputStream is = jar.getInputStream(entry);
    ByteArrayOutputStream os = new ByteArrayOutputStream(1024);
    try{
    byte[] buf = new byte[1024];
    int read;
    while((read = is.read(buf)) > 0) {
    os.write(buf, 0, read);
    catch(Exception e){
         e.printStackTrace();
         return null;
    image = Toolkit.getDefaultToolkit().createImage(os.toByteArray());
    This works but I think you end up opening the jar a second time and downloading it from the server again. Another way of getting the images is using the class loader:
    InputStream is = MyApplet.class.getResourceAsStream(strImageName);
    In this case, the image file needs to be at the same level than MyApplet.class but you don't get the benefit of enumerating of the images available in the jar.

  • OSB - Load Resources From URL using proxy

    Hi all,
    How does one force the OSB to use a proxy server when using the Load Resources From URL option?
    I'm trying to create a wsdl resource from an url, but the OSB needs to use a proxy to access the url.
    I've tried creating a Proxy Server under System Administration -> Global Resources -> Proxy Servers, but I can't seem to find a place to make it use a proxy server?
    How do guys and gals get wsdl files though a proxy?
    Thanks!
    William

    Hi Milan,
    Thanks for your reply.
    I tried setting -Dhttp.proxyHost=12.34.56.78 -Dhttp.proxyPort=80 in the startWebLogic.cmd file under the ...\domain\bin folder. But still can't download the wsdl.
    Where did you set the property?
    thanks again,
    William

  • Loading classes from another jar file

    I've set up my jnpl file so that it references a core jar file (contains main() function). The jnlp also references another jar file (app.jar) which contains class files that I load and instantiate dynamically (using ClassLoader). The core.jar file contains a manifest that includes a reference to app.jar.
    The app works fine when I use "java -jar core.jar" from the command line.
    However, when I wrap the jars using jnlp, I always get a null pointer exception because it cannot find any class that is in the app.jar file. I've tried different strategies, such as trying to load a class file that sits on the server (in a jar file and not in a jar file), but that also fails if I use jnlp (However, it works if I use "java -jar core.jar")
    Any ideas what is going on?

    This is the "OckCore.jar" manifest before signing:
    Manifest-Version: 1.0
    Main-Class: com.Ock.OckCore.OckApp
    Class-Path: . OckMaths.jar
    Created-By: 1.4.0-beta3 (Sun Microsystems Inc.)
    Name: com.Ock.OckCore.OckApp.class
    Java-Bean: FalseThis is the manifest after signing:
    Manifest-Version: 1.0
    Main-Class: com.Ock.OckCore.OckApp
    Created-By: 1.4.0-beta3 (Sun Microsystems Inc.)
    Class-Path: http://hazel/Ock/. http://hazel/Ock/OckMaths.jar
    Name: com/Ock/OckCore/OckApp.class
    SHA1-Digest: KRZmOryizx9o2L61nN+DbUYCgwo=I have removed a load of irrelevant stuff from the "after" manifest to keep it readable.
    note that :-
    The OckApp.class loads normally from webstart and tries to load a class from OckMaths.jar.
    I can prove that OckApp.class does load because it creates a log file when it does.
    The OckApp.class tries to load a class from the OckMaths.jar. This fails if webstart is used but works if OckCore is launched using "java -jar OckCore.jar".
    The jars do exist at the location specified by the manifest.
    The application launches normally if I use "java -Jar OckCore.jar"
    Here is the jnlp file
    <?xml version='1.0' encoding='UTF-8'?>
    <jnlp
         spec="1.0"
         codebase="http://hazel/Ock"
         href="OckMaths.jnlp">
         <information>
              <title>Ock Maths Demo</title>
              <vendor>Rodentware Inc</vendor>
              <description>Demo of a ported app running as a Java Webstart application</description>
              <description kind="short">An app running as a Java Webstart application"></description>
              <offline-allowed/>
         </information>
         <security>
              <all-permissions/>          
         </security>
         <resources>
              <j2se version="1.3"/>
              <jar href="OckCore.jar"/>
              <jar href="OckMaths.jar"/>
         </resources>
         <application-desc main-class="com.Ock.OckCore.OckApp">
    </jnlp> I have also signed the jars outside of a webdirectory. I get the following manifest file:
    Manifest-Version: 1.0
    Main-Class: com.Ock.OckCore.OckApp
    Created-By: 1.4.0-beta3 (Sun Microsystems Inc.)
    Class-Path: . OckMaths.jar
    Name: com/Ock/OckCore/OckApp.class
    SHA1-Digest: KRZmOryizx9o2L61nN+DbUYCgwo=
    note that :-
    The jars do exist at the location specified by the manifest.
    The application launches normally if I use "java -Jar OckCore.jar".
    The application doesn't launch from webstart.
    I've found that cache, but the jar files have been renamed.
    OckCore.jar is anOckCore.jar, etc... so I'm not sure if trying to write a cmdline will work anyway.

  • Is it possible to load classes from a jar file

    Using ClassLoader is it possible to load the classes from a jar file?

    URL[] u = new URL[1] ;
    u[0] = new URL( "file://" + jarLocation + jarFileName + "/" );
    URLClassLoader jLoader = new URLClassLoader( u );
    Object clsName = jLoader.loadClass( clsList.elementAt(i).toString() ).newInstance();
    I get this error message.
    java.lang.ClassNotFoundException: ExceptionTestCase
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
    // "file://" + fileLocation + fileName + "/" This works fine from a browser.
    Is there anything I am missing? Thanks for the reply.

  • Loading icons from a jar

    Hi all,
    I've got my application that loads icons from a relative path, such as "img/tree/menu.png". While running outside the jar it works fine, but when I create a jar of my filesystem I cannot load the icon (i.e., it is not found). The jar of course contains the icons and the relative path.
    Anybody has a clue about?
    Thanks,
    Luca

    I am loading the images for my application. For my application in development phase - I am putting the image in the source folder as well as in the jar file.
    Here is the code I am using
    try
                   URL url = this.getClass().getClassLoader().getResource(imageName);
                   if (url == null)
                        url = new File(imageName).toURL();
                   JLabel logo = new JLabel(new ImageIcon(url));image name is the name of the image say "xyz.gif"
    In the jar file just include the image files and it should work fine.

  • Loading images from a JAR

    Hi,
    My class is currently stored in a subdirectory of my JAR file, and in the directory with the class is a "textures" directory, containing all of my images.
    When I run my class from the directory before I zip it up to be a JAR, it works fine. But, as soon as I run it as a JAR file, it crashes when loading the images.
    Here's the code I'm using to load the images:
    BufferedImage temp = null;
    String path = this.getClass().getResource("textures/" + imagePath).toString();
    temp = ImageIO.read(new File(new URI(path)));What am I doing wrong?
    Thanks for any assistance! =)

    Hiii bro ,
    I think this will help u ,,,,,,,,
    suppose you have a folder Image , under that folder there are some image files and you have a main class say TestMain.class .
    In your main class(TestMain)
    import javax.swing.ImageIcon;
    Now write this code into your main class----------->
    public ImageIcon customOpenIcon = new ImageIcon(TestMain.class.getResource("/image/expanded.gif"));Thanks,
    sb

  • How to retrieve resources from a jar file ?

    Hello,
    Currently, I have application classes in a jar file, and all other resources (pictures, properties, and so forth..) in my windows folder. I do not have any problem for using them such way. For example to set an icon to a JFrame I have coded :
    f.setIconImage("mypicture.jpg");To make installation easier, I'd like to put my picture into the jar file with the classes. Is it possible ? if so, how should I modify my code to make things work ? Should I specify a special path ?
    Thanks for all
    Gege

    Thanks a lot, I'm going to try both ways.What both ways? Both replies are about the same thing -- using the classpath to find resources.
    The question now is what about if there is the same file
    name in the jar file and also in the directory ? Is
    there a search hierarchy ?It will find the first one it encounters in the classpath. You shouldn't have 2 resources with the same name in the classpath -- that's just like having two classes with the same package and class name.

  • Loading images from a jar file

    Hi,
    My application displays images, until it's placed in a JAR file, then it can't display them even though the JAR file contains the images.
    I saw this problem in a previous question which was solved using
    URL url = MyClass.class.getResource("abc.gif");
    Image img=Toolkit.getDefaultToolkit().getImage(url);
    ....which btw didn't work for me either......
    This method should be made obsolete using ImageIcon, which I am using, but the images still won't appear...
    Any suggestions?

    It works fine that way (...getClass().getResource....) until I create the jar file, and then I get a null pointer exception when it tries to load the image.
    When I use
    javax.swing.ImageIcon icon = new javax.swing.ImageIcon(("/images/imageName.jpg"));
    the application works but without the images.......

  • How To Load Sound From Inside jar File?

    Hello There
    i've made a jar file that contains Images&Pictures But I Can't Use Them
    So I Used For Loading Images
      URL url = this.getClass().getResource("image.jpg");
             setIconImage(new ImageIcon(url).getImage());and for loading sound when i use
      URL url = this.getClass().getResource("Bond2.wav");         
           AudioInputStream stream = AudioSystem.getAudioInputStream(new File(url));there's an error That The file Constructor doesn't take url
    how can i fix it?

    First_knight wrote:
    and for loading sound when i use
      URL url = this.getClass().getResource("Bond2.wav");         
    AudioInputStream stream = AudioSystem.getAudioInputStream(new File(url));there's an error That The file Constructor doesn't take url
    how can i fix it?Remove the "new File()". There is a getAudioInputStream() method that takes a URL.
    AudioInputStream in = AudioSystem.getAudioInputStream(url);

  • Loading images from jar

    Found a good solution that works from running in command line, i.e java -jar or normally or using web start and not getting missing image URL loading from jar
    It deserves some dukes :) Also, someone can improve on it to make sure it's 100%
    Asume the function is in a package AWTUtilities class
    Many forums provide close solution but they all forget the vital replacing back slash with forward slash when reading from jar!! :)
    That's what got me stump for a good day trying to figure why it should load the images, but it's not...
    Regards
    Abraham Khalil
       // The subtlety in getResource() is that it uses the
       // Class loader of the class used to get the rousource.
       // This means that if you want to load a resource from
       // your JAR file, then you better use a class in the
       // JAR file.
       public static Image getImageResource( String name ) throws java.io.IOException {
          return getImageResource( AWTUtilities.class, name );
       public static Image getImageResource(Class base, String name ) throws java.io.IOException {
          if (name != null) {
             Image result = null;
             // A must, else won't pick the path properly within the jar!!
             // For file system forward or backward slash is not an issue
             name = name.replace('\\', '/');
             // For loading from file system using getResource via base class
             URL imageURL = base.getResource( name );
             // For loading from jar starting from root path using getResource via base class
             if (imageURL == null) {
                imageURL = base.getResource("/" + name );
             // For loading from file system using getSystemResource
             if (imageURL == null) {
                imageURL = ClassLoader.getSystemResource( name );
             // For loading from jar starting from root path using getSystemResource
             if (imageURL == null) {
                imageURL = ClassLoader.getSystemResource("/" + name );
             // Found the image url? If so, create the image and return it...
             if ( imageURL != null ) {
                Toolkit tk = Toolkit.getDefaultToolkit();
                result = tk.createImage( (ImageProducer) imageURL.getContent() );
             return result;
          else {
             return null;

    The problem is that you use the wrong classloader. The system default classloader is the one that launched the webstart utility. It doesn't contain your classes or jars. You have to get hold of the classloader for your classes.
    Here's my solution as a schetch: probably it won't compile but you get the idea:
    // 1: get hold of the classloader for my classes:
    // - this class cannot possibly be loaded by anyone else:
    Object dummy = new Object(){
    public String toString() { return super.toString(); }
    ClassLoader cl = dummy.getClass().getClassLoader();
    // 2: get an inputstream to read resource from from jar:
    InputStream is = cl.getResourceAsStream("images/myimage.gif");
    // 3: create image from inputstream
    // can be done in many different ways using tmp-files etc.
    ImageIcon icon = new ImageIcon(is);
    Image img = icon.getImage();

  • Loading images from Jar - Please help!

    Tried with / in front of the path or without and using both
    getImageResource and getSystemImageResource methods and no images
    are showing.
    My jar has manifest file of:
    Main-Class: com.package.MainFrame
    Class-Path: j2ee.jar
    - blank line -
    Thanks
    Abraham Khalil
       // The subtlety in getResource() is that it uses the
       // Class loader of the class used to get the rousource.
       // This means that if you want to load a resource from
       // your JAR file, then you better use a class in the
       // JAR file.
       public static Image getImageResource( String name ) throws java.io.IOException {
          return getImageResource( AWTUtilities.class, name );
       public static Image getImageResource(Class base, String name ) throws java.io.IOException {
          Image result = null;
          URL imageURL = base.getResource( name );
          if (imageURL == null) {
             imageURL = base.getResource("/" + name );
          System.out.println("imageURL: " + imageURL + " AWTUtilities.class.getResource(" + name + ");");     
          if ( imageURL != null ) {
             Toolkit tk = Toolkit.getDefaultToolkit();
             result = tk.createImage( (ImageProducer) imageURL.getContent() );
          return result;
       public static Image getSystemImageResource( String name ) throws java.io.IOException {
          Image result = null;
          URL imageURL = ClassLoader.getSystemResource( name );
          if (imageURL == null) {
             imageURL = ClassLoader.getSystemResource("/" + name );
          System.out.println("imageURL: " + imageURL + " = ClassLoader.getSystemResource(" + name + ");");
          if ( imageURL != null ) {
             Toolkit tk = Toolkit.getDefaultToolkit();
             result = tk.createImage( (ImageProducer) imageURL.getContent() );
          return result;

    Hello,
    you must put your images files under your package :
    see full doc at this tutorial.
    Hope this helps,
    Neo

  • Loading image from jars only once in oracle forms 10g

    Hi,
    I have an oracle forms 10g application which loads image from a jar. Every time i click on a button "A" that loads the image "image" on another button "B" in the same screen, a message is displayed in the java console "Loaded image: jar:https://+IP+/forms/java/+myjar+.jar!/image.gif". So after 10 clicks, i get the same message displayed 10 times. In the form, i've called:
    SET_CUSTOM_PROPERTY(p_object_name, 1, 'IMAGE_NAME_ON', '/'||p_image_name);My question is the following:
    - is there a way to load this image once and use it later without having to load it every time i clik on "A"? if yes, how?
    P.S.: if this thread shouldn't be posted in this forum, please redirect me to the right one.
    Thanks in advance

    Ah okay.
    I'm using the rolloverbutton.jar (RollOver Button PJC) [RolloverButton.java -> authors: Steve Button, Duncan Mills].
    Here is the part concerning the IMAGE_NAME_ON function:
    // make sure we are in rollover mode
    enableRollover();
    log("setProperty - IMAGE_NAME_ON value=" + value.toString());
    // load the requested image
    m_imageNameOn = (String) value;
    loadImage(ON,m_imageNameOn);
    // reset the currrently drawn image if needed
    setImage(ON,m_state);
    return true;where loadImage function is:
        URL imageURL = null;
        boolean loadSuccess = false;
        //JAR
        log("Searching JAR for " + imageName);
        imageURL = getClass().getResource(imageName);
        if (imageURL != null)
          log("URL: " + imageURL.toString());
          try
            m_images[which] = Toolkit.getDefaultToolkit().getImage(imageURL);
            loadSuccess = true;
            log("Image found: " + imageURL.toString());
          catch (Exception ilex)
            log("Error loading image from JAR: " + ilex.toString());
        else
          log("Unable to find " + imageName + " in JAR");
        //DOCBASE
        if (loadSuccess == false)
          log("Searching docbase for " + imageName);
          try
            if (imageName.toLowerCase().startsWith("http://")||imageName.toLowerCase().startsWith("https://"))
              imageURL = new URL(imageName);
            else
              imageURL = new URL(m_codeBase.getProtocol() + "://" + m_codeBase.getHost() + ":" + m_codeBase.getPort() + imageName);
            log("Constructed URL: " + imageURL.toString());
            try
              m_images[which] = createImage((java.awt.image.ImageProducer) imageURL.getContent());
              loadSuccess = true;
              log("Image found: " + imageURL.toString());
            catch (Exception ilex)
              log("Error reading image - " + ilex.toString());
          catch (java.net.MalformedURLException urlex)
            log("Error creating URL - " + urlex.toString());
        //CODEBASE
        if (loadSuccess == false)
          log("Searching codebase for " + imageName);
          try
            imageURL = new URL(m_codeBase, imageName);
            log("Constructed URL: " + imageURL.toString());
            try
              m_images[which] = createImage((java.awt.image.ImageProducer) imageURL.getContent());
              loadSuccess = true;
              log("Image found: " + imageURL.toString());
            catch (Exception ilex)
                    log("Error reading image - " + ilex.toString());
          catch (java.net.MalformedURLException urlex)
            log("Error creating URL - " + urlex.toString());
        if (loadSuccess == false)
          log("Error image " + imageName + " could not be located");In this case, what shall i modify?
    Thanks in advance

  • Loading resources via classpath

    My application should load resources (as XML files) from the ClassLoader. For example, this code fragment should load the file "constantes.xml" if it is on the claspath:
    ClassLoader cl = ClassLoader.getSystemClassLoader();
    InputStream recurso = cl.getResourceAsStream("constantes.xml");
    Unfortunately, when running this code within the Application Server, it does not work! However, the file is reachable through the claspath. I printed the property "java.class.path" on the exception catch and it was there. That is, the directory where this file is located.
    Have you ever faced this strange problem? It is so strange to me. Maybe something related to class loading that I really don't understand.
    marcelo.

    Thank you Debu Panda for the invaluable assistance.
    I am using Oracle Application Server 9.0.2.0.0 container for J2EE (oc4j). I am
    assuming it has the same rules of class loading than Orion Application Server: http://kb.atlassian.com/content/atlassian/howto/classloaders.jsp
    Is that right?
    I have a library similar to struts (handlerv3-4), which loads classes from my application. I
    decided to bundle the EJB and this library together in a single jar file. Since
    then, many problems were resolved. However, a class of this library have to load
    a resource declared in orion-application.xml. And it cannot find the resource.
    When I use a FileInputStream to read the resource directly from the file system,
    everything works fine. So, I am inclined to believe this is the point. This is
    the way I declared the resource directory on orion-application.xml:
    <library path="../../../../../../temp/conf"/>
    The path appears on the classpath correctly. On the (struts like) library a
    class loads the resource using the command:
    InputStream resouce =
    Thread.currentThread().getContextClassLoader().getSystemResourceAsStream(
    xmlName);
    And it doesn't find the resource. Here is the class loader trace for the library.
    Note below that I changed orion-application.xml to load the resource from a jar (
    conf.jar) instead of a path. I tested both ways:
    #(handlerv3-4)#[ClassLoader: [[C:\JBuilder6\oc4j_extended\j2ee\home\lib2], [C:\J
    Builder6\oc4j_extended\j2ee\home\lib2/conf.jar], [C:\JBuilder6\oc4j_extended\j2e
    e\home\lib2/handlerv3-4.jar], [C:\JBuilder6\oc4j_extended\j2ee\home\lib2/kcServl
    et.jar], [C:\JBuilder6\oc4j_extended\j2ee\home\lib2/libgeral.jar], [C:\JBuilder6
    \oc4j_extended\j2ee\home\lib2/log4j-core.jar], [C:\JBuilder6\oc4j_extended\j2ee\
    home\lib2/log4j.jar], [C:\JBuilder6\oc4j_extended\j2ee\home\lib2/mail.jar], [C:\
    JBuilder6\oc4j_extended\j2ee\home\lib2/oemCrypto.jar], [C:\JBuilder6\oc4j_extend
    ed\j2ee\home\lib2/pop3.jar], [C:\JBuilder6\oc4j_extended\j2ee\home\lib2/radix_ut
    il.jar], [C:\JBuilder6\oc4j_extended\j2ee\home\lib2/worp_brt.jar], [C:\JBuilder6
    \oc4j_extended\j2ee\home\applications\mobile_ebpp_brt/grupoW2bBrt.jar], [C:\JBui
    lder6\oc4j_extended\j2ee\home\applications\mobile_ebpp_brt/grupoCarga.jar]]]
    #(handlerv3-4)#java.net.URLClassLoader@7ebe1
    #(handlerv3-4)#sun.misc.Launcher$AppClassLoader@71732b
    #(handlerv3-4)#sun.misc.Launcher$ExtClassLoader@7fdcde
    I use the same code, i.e.:
    ClassLoader classloader = Thread.currentThread().getContextClassLoader();
    while (classloader != null){
    System.out.println("#(libgeral)#" + classloader.toString());
    classloader = classloader.getParent();
    in a class stored in another library declared in orion-application.
    xml. It was surprising to see that the print out was **exactly** the same!
    However, in this case the class can load the resource. Maybe because they are
    declared in the same class loading level.
    best regards,
    marcelo.

Maybe you are looking for