• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

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

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic