• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Failed to load Main-Class manifest attribute from HelloWorld.jar

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends,

I am trying to create a simple jar file "HelloWorld.jar"

In command prompt,went to location

"D:\test-workspace\JavaJar\bin" where "HelloWorld.class" is present.

Created "manifest.txt" and put "Main-Class: HelloWorld"

D:\test-workspace\JavaJar\bin>jar cfm HelloWorld.jar Manifest.txt HelloWorld.class

jar file is created "HelloWorld.jar"

I try to run the jar file

D:\test-workspace\JavaJar\bin>java -jar HelloWorld.jar

But error is thrown as

Failed to load Main-Class manifest attribute from HelloWorld.jar

I have extracted the jar file and look into it

I can see HelloWorld.class and MANIFEST.MF

But MANIFEST.MF is blank

I have already mentioned in "manifest.txt" as "Main-Class: HelloWorld"

How can i run the execute the jar file?

Regards,
Anand
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can try this command to create the JAR file:

jar cfe HelloWorld.jar HelloWorld HelloWorld.class

The "e" option is to set the entry point, this would create the manifest automatically with the correct entry point. See this tutorial.
 
Anand Sivathanu
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jesper de Jong wrote:You can try this command to create the JAR file:

jar cfe HelloWorld.jar HelloWorld HelloWorld.class

The "e" option is to set the entry point, this would create the manifest automatically with the correct entry point. See this tutorial.



Thanks Jesper de Jong!!!

its working fine
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic