Creating jar file
Hi,
I'm trying to create a jar file. I have the tutorial in front of me, but something is messed up. I am typing:
jar cfm MyJar.jar Manifest.txt MyPackage/*.class (obviously with the appropriate package) into the command line.
However, it tells me 'jar' is not recognized as an internal or external command, operable program or batch file.
What does this mean? Do I not have JVM installed or something?
Thanks for any help,
Dan
[473 byte] By [
Djaunla] at [2007-10-3 3:29:46]

the 'jar' executable isn't being found. if you can use 'javac', you should be able to use 'jar'... they're in the same folder.check if you have installed JRE instead of JDK...
Hi,
Hmm, I may have JRE installed instead of JDK. I'll check tomorrow morning when I get to work.
Just wondering, is there a certain directory I need to run the 'jar' command from? I've been trying from my package directory...do I need to run it from the java directory or something?
Thanks,
Dan
Wait no, I know I have JDK installed. Is there something else that could be causing the problem?
does your "javac" command work?coz if it works "jar" command should too, their in the same directory as javac-Nywled
> does your "javac" command work?
> coz if it works "jar" command should too, their in
> the same directory as javac
>
>
> -
> Nywled
What directory would that be? What directory must I run the commands from? I've been using Eclipse to run my Java apps, not javac. I've tried exporting a jar file with Eclipse, but that hasn't worked for some reason.
Is there a certain directory I must run these commands from?
You can run from any directory. Only make sure that your env PATH variable contains the <JDK Install dir>\bin where all the javac and jar executables would be present.Then you can run jar command from any folder you may be in.Hope this helpsThanksAviroop
set your PATH environment variable with 'bin' folder of your JDKif you are using Linux, ask somebody else =P
Ok, I just have one last question. How do I set the PATH environment variable? Where do I set it from and stuff?Thanks for the help,Dan
Hi,
Never mind the PATH variable, I figured out how to do it.
However, when I create my jar file, it tells me it can't find the main class.
"Exception in thread "main" java.lang.NoClassDefFoundError: jena/GUI"
What does this mean? I can compile the java file into a .class file fine, and I can run it as a java application using Eclipse. What is it talking about?
EDIT: I opened my jar file with winzip, and it includes everything necessary, I think. It has the manifest file, and all my .class files from the jena package. Here is the command I used to create it:
c:\sun\appserver\jdk\bin\jar cfm MyJar.jar c:\kdb\jena\Manfiest.txt c:\kdb\jena/*.class
Message was edited by:
Djaunl
Hi,Sorry to bump this, but I've searched around, and it seems the problem could be a classpath error. Is there any way to check this out?
just a manifest file isn't enough... you need a manifest that specify your main class http://java.sun.com/j2se/1.3/docs/guide/jar/jar.htmlthis one should be more helpful: http://java.sun.com/docs/books/tutorial/deployment/jar/
Hi,Thanks for the links. I have finally succesfully created a .jar file that runs. I am still having a problem, but that is more related to the classpath, so I'm going to create a new thread for that.Thanks for all the help,Dan