Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

excutable jar file error plz help  RSS feed

 
hassan ali
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is error message when trying to run excutable jar file

Failed to load Main-Class attrribute from ....

while this was written in the manifest file

Manifest-Version: 1.0
Main-Class:FTP_Client

this comand to generate jar file
jar cvfm manifest.mf FTP_Client.jar *.class *.java
 
Campbell Ritchie
Sheriff
Posts: 53774
128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the Java Tutorial about .jar files and particularly the bits about mainfest files. You need to specify the name of the class with the main method inside the manifest file.
 
hassan ali
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found this solution by try

1 - set your compiled files with jar.exe file inside java jdk folder
2 - write MANIFEST.MF name all in Capital with your comiled file too
3- write this inside MANIFEST.MF file

Manifest-Version: 1.0
Main-Class: FTP_Client

replace FTP_Client with your file that contain main class

4 - type this in your command prompet

c:\jdk_folder\bin\jar cvmf MANIFEST.MF cLIENT.jar *.class

change cLIENT.jar to what you like to be your jar excutable name
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!