Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4110602

URLClassLoader not loading classes from jar local Class-Path

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.2beta3
    • CPU:
      sparc
    • OS:
      solaris_2.6
    • Verification:
      Not verified

      Description

      I have attached a loader.tar.gzip that contains a simple test program
      and a couple jar files.

      From the comment in JarFileTest.java:

      /*
       * It seems the URLClassLoader is not locating classes from the
       * jar file's Class-Path attribute.
       *
       * I have foo.jar contain Foo.class, which has a dependency on Bar.class
       * which is contained in Bar.jar. The maniofest file for foo.jar has
       * the attribute Class-Path: bar.jar
       *
       * I create a URLClassLoader with the url array containing just the URL
       * to foo.jar.
       *
       * I get a NoClassDefFoundError for Bar.class, when I try an instantiate
       * Foo.class (I thought the URLClassLoader was supposed to define the classes
       * from the union of the url array in the URLClassLoader's constructor with
       * the jars listed in the Class-Path attribute.
       *
       * If I add bar.jar to the url array to the URLClassLoader constructor, all is ok.
       *
       * Must we (JWS/JS) analyze the jar hierarchy prior to cretaing a URLClassLoader?
       * This would contradict the claim in the spec:
       * http://java.sun.com/products/jdk/1.2/docs/guide/extensions/spec.htm
       *
       */

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              brenaudsunw Benjamin Renaud (Inactive)
              Reporter:
              duke J. Duke (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: