• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

How to use manifest.mf ?

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I know that when you create a jar file for your source code, a file called manifest.mf is created within the archive, and that this file can be use to make the archive self executing.
What i would like to know is how do i modify this manifest file to load the class that contains main() ?
thanks in advance
Dave
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Add a Main-Class: entry to the manifest file.
Complete documentation about JARs is installed with your JDK. Look in "docs/guide/jar/jar.html#Main Attributes" in your JDK or online for information about Main-Class and other important manifest attributes.
- Peter
 
Dave Turner
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks,
ive tried this, yet when i double click on the jar file in explorer, nothing happens....
any suggestions?
Dave
 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Be sure to add an enter to the class name, like this:
Main-Class: Bonk[press enter here]
Hope this helps!
//Kaspar
 
Dave Turner
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was previously adding my manifest file after creating the jar, and it was not executing, however now i have been trying to create the jar file with the correct manifest file. The problem now is that i get an error when trying to create the jar:
java.io.IOException: invalid header field
at java.util.jar.Attributes.read(Attributes.java:354)
my manifest file is as follows:
1:Manifest-Version: 1.0
2:
3:Main-Class: VendApp
4:
Can anyone suggest what i am doing wrong?
thanks
Dave
 
Dave Turner
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyone ??
I can not understand what i have done wrong, ive followed the tutorial instructions yet i still can not get the jar to execute.
[This message has been edited by Dave Turner (edited November 05, 2001).]
 
Kaspar Dahlqvist
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Last time I successfully made an executable jar I just put the following line in some text file (rune.txt):
Main-Class: Test2[enter]

One line and one concluding enter...
Then I executed the following line at the dos prompt:
jar cmf rune.txt AAA.jar Test2.class
That's all there was to it!
//Kaspar
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic