Creating jar files

shwaipshwaip bluffin' with my muffin Icrontian
edited January 2004 in Internet & Media
I'm having trouble creating a jar file. I try this:

java -jar cf jarname.jar classname.class

(I use the real names ;))

and all I get is
Exception in thread "main" java.util.zip.ZipException: The system cannot find the file specified
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(Unknown Source)
at java.util.jar.JarFile.<init>(Unknown Source)
at java.util.jar.JarFile.<init>(Unknown Source)

Comments

  • GobdGobd Seattle, WA
    edited January 2004
    Maybe i'm totally off here, but isn't .jar just a method of compression? I know WinACE can make .jar files perfectly fine because i had to do it a lot when i was hacking .jar file in Firebird this weekend. I believe that they are even just .zip files renamed to .jar but i could be wrong on that one.
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited January 2004
    Unless I was misled by my CS220 TAs (entirely possible), if you have a .jar file created properly, you can run it similarly to an executable.
  • ShortyShorty Manchester, UK Icrontian
    edited January 2004
    Schwaip.. I recieved this in email from a guest :)
    I'm not a member of your message board, but I did come across a posting by shwaip for which I have the answer. If you can pass this along to him, great.

    He is trying to create a jar file using

    java -jar cf jarname.jar classname.class

    This is how you run an application packaged as a jar file where classname.class contains the main class.

    He must use the jar tool to create a Java Archive. e.g.

    jar cf jarname.jar classname.class

    I hope this helps him.

    How cool is that? :respect:
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited January 2004
    nice. thanks Shorty, and the unknown person...however, whenever I try to type

    jar cf jarname.jar classname.class

    I get an error that jar is not a recognizable command/program/batch file.

    edit://

    Figured it out
Sign In or Register to comment.