Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

jar problem

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody!
If anyone can please help me, I want to run a jar on windows 2000 command prompt:
�java �jar jarName.jar�
I am getting this error message:
�Failed to load Main-Class mainfest attribute from jarName.jar�
Please give me some advises
Regards,
Gidone
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi gidones,


�Failed to load Main-Class mainfest attribute from jarName.jar�


That probably means that you don't have a main class declared in the manifest. Inside the jar file (which is only a zip file with a different extension) there is a directory META-INF and in that directory, there should be a file named MANIFEST.MF. In that file are contained attributes for the jar file. For a jar to be executable, there must be Main-Class attribute. Here is an example of what a MANIFEST.MF file might look like:

That would work if MyClass were in the default (undeclared) package. If it were in say myPackage.main then our manifest would look like this:

Hope this helps,
Michael Morris
 
reply
    Bookmark Topic Watch Topic
  • New Topic