• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with JAR file

 
Bharadwaj Adepu
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ive created a Jar File thar does perfom some file comparision stuff.
When i run the Jar file via command prompt,
java -jar FileCompare.jar

it works fine but when i double click the jar file it does'nt work, it throws an error
"Could not find the main class. Program will exit."

What could be the reason.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you put a Main attribute in your manifest file? Have you got a newline at the end of your manifest file?
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you got a file association in your OS to associate jar files with the appropriate java runtime?
 
Bharadwaj Adepu
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Yes, Ive put the Main Attribute in the manifest file. Its working fine with command prompt, but fails to run when i double click it.


Sorry i dint get you!!
 
Bharadwaj Adepu
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any one please help me!!
 
Prakash Subramanian
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you see your JAR file being displayed with a standard java coffee icon in your windows explorer view? It should list as an executable jar file. If so, then your OS file association is right. Else you can just click on 'open with' and then associate your java.exe with it. Make sure your manifest file is right, as mentioned in the previous post. It is easy to miss out.

I guess this should be moved to the beginner's forum.
 
Rob Spoor
Sheriff
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bharadwaj,

please read the following link: PatienceIsAVirtue
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic