• 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Run the .jar file

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
When i try to run the .jar file,the following error is thrown.
"Failed to load Main-Class manifest attribute from"
How could i correct the above error.
As i'm very much new to this jar file creation.I tired with
following sample
jar cf sample1.jar GetIP.class
and just i run the .jar as
java -jar sample1.jar

is that rite are something else need to follow?
correct me if i'm wrong.

-Thanks & Regards,
Hamsa
 
Marshal
Posts: 76095
362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to put the name of your class with the main method in the jar's manifest file. Read this, particularly the bits about manifest files and setting the entry point.
 
Hamsagayathri Palanisamy
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Campbell Ritchie:
You need to put the name of your class with the main method in the jar's manifest file. Read this, particularly the bits about manifest files and setting the entry point.





Thank you campbell. It works fine.

-Thanks & Regards,
Hamsa
 
Campbell Ritchie
Marshal
Posts: 76095
362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome, and well done.
 
Hamsagayathri Palanisamy
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
one more doubt please
In my jar file named Myjar having the following contents..
under MyPackage

--> MyClass
--> Image file (bmp)

"MyClass" takes "Image file" as input and produce another "Image file" (bmp)as output.
I want to write that output of that "MyClass" to the "Myjar".
How can we do that?is there any possibility?

-Thanks & Regards,
Hamsa
 
Campbell Ritchie
Marshal
Posts: 76095
362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't know. Probably not, I am afraid. The idea of jar files is to contain executable file and resources. Not for output.
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can update an existing JAR file like this.



You'll have to try it and see whether the new image.bmp is added to the JAR or overwrites the existing file.
 
reply
    Bookmark Topic Watch Topic
  • New Topic