Click to See Complete Forum and Search --> : Building An Executable Jar


nick666
July 10th, 2002, 06:48 AM
Hi !!!
I try run a stand-alone application from a jar file and it is not working. I will give the details below.

1. I have a jar file called Hello.jar with the following content
- directory META-INF which contains the file MANIFEST.MF
- directory tests which contains the file HelloWorld.class.
In the HelloWorld.class the method main is implemented.

2. The file MANIFEST.MF has the following format:

Manifest-Version: 2.0
Main-Class: tests.HelloWorld
Created-By: 1.3.0 (Sun Microsystems Inc.)
My-Information: this is my own added field

The lines and the end of file are properly ended with a CR\LF pair.

As far as I read from SUN documentation there are 2 ways to execute the code from Hello.jar
1. java -cp Hello.jar tests.HelloWorld
2. java -jar Hello.jar -> which uses the MANIFEST.MF file for the
detection of the main class.

Unfortunately none of the above methods are working.
Where is the mistake ????
By the way, as OS I am using WIN 2K PROFESSIONAL.

PS: I attached the jar file to this post.
The good answers will be rewarded !!!!

Goodz13
July 10th, 2002, 08:31 AM
I didn't see a problem with your ManiFest.
Sorry I had to decompile your program in order to see the problem.

Your problem is your main method.

Your main Method should be:

public static void main(String args[]) {

// you have
public void main(String params[])

Goodz13
July 10th, 2002, 08:33 AM
It's been a while since I've been here. It looks like the tags for code have changed.