This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Executable Jar problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Executable Jar problem" Watch "Executable Jar problem" New topic
Author

Executable Jar problem

Jhakda Velu
Ranch Hand

Joined: Feb 26, 2008
Posts: 166
Hi All
I was trying to make a small application and give to my users as a executable jar file. My application is a single screen developed in swing with the processing logic in a POJO. The main method is the same class as that making the swing screen. When I package the application,though it starts on double click and the swing screen comes up, nothing happens on call of the pojo.I've checked this by putting popups before and after the new call on my pojo, the first one comes up,when the one after the new call doesn;t. However, teh same executes well through Eclipse on any system. In my system,the jar file also works.
I tried mentioning the jars used by my POJO in the manisfest classpath varible also. When i explode the jar created, it does contain all the necessary jar files in its lib folder.
I'm a bit stuck and some fresh idea will be most welcome.
That the JAR works on my system and doesn't on others is troubling me. Also, how come Eclipse is able to run the code?

Thanks

Jhakda


If I become filthy rich, I'll sponsor research for painless dental treatment at Harvard Medical School. Thats why,I'm learning Java.I have 32 teeth, 22 are man made.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9990
    
    7

Instead of double clicking to launch the jar, run it from the command line using the java -jar JarFileName.jar That way you can look at exception stack trace if any.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Jhakda Velu
Ranch Hand

Joined: Feb 26, 2008
Posts: 166
Hi
Thanks for the input. I checked it out that way, and found that it is unable to find a jar file referred from the POJO. I tried to put the required jars through the manifest file Classpath variable
Class-Path: jxl.jar log4j-1.2.9.jar
and also
Class-Path: lib/jxl.jar lib/log4j-1.2.9.jar
Both the jars are there when i explode the jar i created (in the lob folder).
Whats going wrong? why is the application unable to find the jars?

Thanks
Jhakda
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9990
    
    7

Jars inside jars are not picked up by the class-path.
Check this out for more details
http://java.sun.com/docs/books/tutorial/deployment/jar/downman.html
Jhakda Velu
Ranch Hand

Joined: Feb 26, 2008
Posts: 166
Hi
Many Thanks!!
I placed the 2 needed jars in the same folder as the jar i create and it works just fine.
Thanks a lot once again.

Jhakda
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Executable Jar problem
 
Similar Threads
Screen doen not render the same on all computers
Building an executable with Eclipse
eclipse plug-in architecture jars
Error connecting to database from executable JAR file.
getResource( path) fails in Jar