File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes Help with building executable jar with ant. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Help with building executable jar with ant." Watch "Help with building executable jar with ant." New topic
Author

Help with building executable jar with ant.

Unnsse Khan
Ranch Hand

Joined: Nov 12, 2001
Posts: 511
Hello,

I tried to make an executable jar (a jar file that contains a main method, and once a user clicks on it from WinXP, it launches)...

The following code compiles correctly, but when I click on the jar file, nothing happens... Sorry if this post was supposed to be in a different forum other than the one for ant.

Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Did you take a look at the manifest file from the created jar file?


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Unnsse Khan
Ranch Hand

Joined: Nov 12, 2001
Posts: 511
Yes, I did... I extracted the jar file and found a META-INF directory which contained a MANIFEST.MF file...

The MANIFEST.MF file's contents were:



Is this correct? How do I invoke an executable jar from the command line and/or ant target?

Many, many thanks!

All the best,
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
That looks correct. If I remember correctly, though, the file needs to have *two empty lines at the end* (that is, after Main-Class entry). You should check for that...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help with building executable jar with ant.