Jar creates inconsistently named class members

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Won't Fix
    • Priority: P5
    • None
    • Affects Version/s: 5.0
    • Component/s: tools
    • jar
    • x86
    • windows_xp

      A DESCRIPTION OF THE REQUEST :
      Newbies trip all the time on creating a jar containing a class named
      MyClass.class when the class's true name is com.mydomain.mypackage.MyClass and the member's name should be com/mydomain/mypackage/myClass.class. Jar gives not even a warning.

      It is awkward spelling out the full package names over and over on teh jar command line.

      JUSTIFICATION :
      I have explained this over and over to newbies on the newsgroups but they have a hell of a time understanding jar's behaviour. Everyone including myself lost patches of scalp trying ot figure it out.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      When you include a class file, Jar should look inside the class file to discover its package and use that as the member name. It shoud not matter precesly what filename you used to reference the class file on the command line.

      Failing that, jar.exe should give you a warning message if the generated member name does not jibe with the package name embedded in the class file.
      ACTUAL -
      Jar happily creates jar files where the package name does not match the member name. These of course blow up with the dreaded generic NoClassDefFoundError at run time baffliing the heck out of everyone.


      ---------- BEGIN SOURCE ----------
      this works:
      REM preparing a jar for com.mindprod.bulk.Bulk
      C:
      CD C:jar.exe -cvfm com\mindprod\bulk\bulk.jar com\mindprod\bulk\main.mft com\mindprod\bulk\*.class com\mindprod\csv\*.class

      this does not:

      REM Jar.exe is not very bright. It needs the precise package name information
      REM on its command line, no more, no less for every class.
      C:
      CD C:\com\mindprod\bulk
      jar.exe -cvfm bulk.jar main.mft *.class \com\mindprod\csv\*.class

      The second is more natural.


      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Set the current directory to the directory left of your root package and specify all files with full package qualification.

            Assignee:
            Dave Bristor (Inactive)
            Reporter:
            Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: