aspose file tools*
The moose likes Beginning Java and the fly likes JAR file problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JAR file problem" Watch "JAR file problem" New topic
Author

JAR file problem

Vijay Chandran
Ranch Hand

Joined: Jan 07, 2007
Posts: 178
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

Joined: Aug 16, 2005
Posts: 14149
    
  18

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?


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Vijay Chandran
Ranch Hand

Joined: Jan 07, 2007
Posts: 178
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

Joined: Oct 27, 2005
Posts: 19693
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Vijay Chandran
Ranch Hand

Joined: Jan 07, 2007
Posts: 178
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
 
subject: JAR file problem