Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with building executable jar with ant.

 
Unnsse Khan
Ranch Hand
Posts: 511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you take a look at the manifest file from the created jar file?
 
Unnsse Khan
Ranch Hand
Posts: 511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic