Putting Packaged Classes Into A JAR File

From: Jason Teagle (jason_at_teagster.co.uk)
Date: 10/30/03


Date: Thu, 30 Oct 2003 21:41:55 -0000

I've managed on a previous occasion to take a bunch of class files that were
not part of a package (OK, part of the default package for the pedantic
people out there), bundle them into a JAR file with a manifest naming the
main class, and voila - I can activate the .JAR file and the application
runs. Wonderful.

Now I'm trying to do the same with some other code, but the classes are in a
package and so are in a hierarchy. By doing this:

jar cvfm appname.jar manifest.txt *.*

from the level above the package hierarchy (which would be the place where
the class files were if there was no package) DOES put the files into the
JAR complete with their directory hierarchy (viewing the JAR confirms this).
I tried naming the main class in the manifest file both with and without the
package prefix. In neither case does the finished .JAR "execute" the
application like it did before {:v(

I looked at Sun's explanation of creating JAR files but although they
explain how to build non-packaged ones, they don't say anything about
packages.

Am I doing something wrong, or have I simply missed a step?

-- 
--
Jason Teagle
jason@teagster.co.uk


Relevant Pages

  • Re: OT: It aint what it appears to be
    ... power tools and gadgets, "arrr, arrr". ... would not open its twin package. ... Once I even had to call my son-in-law to open a jar ... released the pressure and the lid turns off easily. ...
    (alt.support.mult-sclerosis)
  • Re: What classes are in a package? Functional requirement
    ... you can turn around and check the package for the ... > that correspond to the classpath. ... The JavaBeans spec allows you to package plugins into a jar and you know ... So the creator of the plug-in has to create a special jar file to indicate ...
    (comp.lang.java.programmer)
  • Re: What classes are in a package? Functional requirement
    ... you can turn around and check the package for the ... > that correspond to the classpath. ... The JavaBeans spec allows you to package plugins into a jar and you know ... So the creator of the plug-in has to create a special jar file to indicate ...
    (comp.lang.java.help)
  • Re: JAR! . . .What is it good for?. . .Absolutely nothing :-)
    ... It ended up pilot error :-( I looked through the JAR manifest and to my ... embarassment I found the EmpApplet and EmpClient classes but sadly no ... the same package don't need to import one another to be visible to one ... might trigger this behaviour in your applet viewer program, ...
    (comp.lang.java.programmer)
  • Re: how to set up a simple plugin mechanism
    ... First we need to assign a unique class name to every possible ... clossnames) These define the names of the members in the jar. ... qualified package names. ... name of any of these classes to a custom class loader, ...
    (comp.lang.java.help)