aspose file tools*
The moose likes Java in General and the fly likes Java application runs in eclipse but not when exported to a jar file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java application runs in eclipse but not when exported to a jar file" Watch "Java application runs in eclipse but not when exported to a jar file" New topic
Author

Java application runs in eclipse but not when exported to a jar file

Robert Stone
Greenhorn

Joined: Jan 06, 2011
Posts: 25
I have never had this issue before and I was wondering if anyone else has had the same issue. I have a small java application that uses the JExcel API http://jexcelapi.sourceforge.net/ to automate some Excel Sheet Reports. The application works fine when run from the Eclipse IDE using the "Run as Java Application" selection from the "File" menu, but when I export it to a Runnable Jar file the application is not working. The application will run, but when I select the file to convert it doesn't create the new file.

Has anyone had this same issue with an application running in Eclipse but not when exported to a jar, and if so how did you overcome it?

Thanks in advance,

Robert
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4179
    
  21

The first thing to do is figure out why it fails. There will be an error message somewhere. Try running the application from the command line to see if the error message gets printed out there. That should help you figure out why the application fails.

You can make all kinds of guesses as to why it might fail. The first guess would be that there is a dependent JAR file which Eclipse adds to the classpath when it runs that you did not add to the classpath for the application - or the dependent JAR is in the wrong location relative to where your application is located. This is the most likely reason for a failure, but there could be others.

Hopefully you can catch the exception to figure out what is going wrong - identify which JAR file you are missing, and can access your application's manifest to figure out why it isn't in the classpath.


Steve
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java application runs in eclipse but not when exported to a jar file