Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAR file problem

 
Vijay Chandran
Ranch Hand
Posts: 186
Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear friends,

I am creating a JAR file which contains the necessary class files and the MANIFEST file. All classpaths and environemnt variables are set perfectly.

But still when i execute the jar file, i am getting the traditional error "MAIN CLASS not found. Program will exit"

Kindly provide your help.

Regards,
Vijay
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does your JAR file contain exactly (you can get a list with jar tvf myjarfile.jar)?
What does the manifest file contain exactly?
Does the manifest file end with an empty line?
 
Vijay Chandran
Ranch Hand
Posts: 186
Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Jesper,

The Manifest file ends with a new line. The JAR file contains some Swing components and other core java classes.

Another problem is, the jar files run in one computer but not in another computer. In one computer, its executing by simply double clicking the jar.

In another computer, its not working when i double click it, right click open with javaw. But it works with right click open with Java(TM) Platform Standard Edition Binary.

Using JDK 5.0!!
Thanks & Regards,
Vijay
 
Rob Spoor
Sheriff
Pie
Posts: 20381
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happens when you type in the following command in a console:

This should show you a stack trace that should be much clearer than just "MAIN CLASS not found. Program will exit". That error is also wrong most of the times; the main class can be found perfectly but some other class cannot.
 
Vijay Chandran
Ranch Hand
Posts: 186
Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Rob,

When i executed that commmand java -jar <jar-file>, the jar EXECUTED perfectly!! which will display a GUI developed in Swing.

Its not working when i double click it or right click open with javaw.

Confused!!
Regards,
Vijay
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic