This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "jar" Watch "jar" New topic


Ruslan Ivanov
Ranch Hand

Joined: Feb 22, 2001
Posts: 72
I followed the direction on sun's site how to create executable jar file but i didn't get far i get an error when trying to run the jar file.
What i did was after creating jar file i modifed the manifest file to have an entry for Main-Class: myClass
but when running the jar file i get no main class is found. What can cause this? Can this be effected by a classpath ? Do i have to include a classpath information into manifest entry?
Barry Andrews
Ranch Hand

Joined: Sep 05, 2000
Posts: 523

How are you trying to run the jar file? From command line? Can you give exactly what you typed in? Also, I don't know if this makes a difference, but I think you need to create the manifest file before making the jar. Give some more information, and I will try to help.
Ruslan Ivanov
Ranch Hand

Joined: Feb 22, 2001
Posts: 72
thanks for replying i solved the problem.
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Don't hold out on us, what was the solution?
It is sorta covered in the JavaRanch Style Guide.
subject: jar
Similar Threads
problem finding resouircebundle?
how to run java -jar with args?
Jar manifest problem
Jar execution command
Jar file exception due to not finding Oracle driver but other standalone programs can use it