Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

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

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!