GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes Problem packaging my app as jar file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Problem packaging my app as jar file" Watch "Problem packaging my app as jar file" New topic
Author

Problem packaging my app as jar file

Dave Robbins
Ranch Hand

Joined: Sep 16, 2003
Posts: 131
Hello All,
I'm trying to build an application that uses a third party class that extends JTable. I developed it in Netbeans and it runs fine. Now I'm trying to package all the class files as a jar and run them from the command line.
When the app first pops up on the screen the third party app isn't used and I get to that point fine, when I push a button that causes the third party class to be instantiated I get a class not found error.
I run it like this
java -jar -cp c:\path_to_jar\third_party.jar myApp.jar
I also tried to unpack third_pary.jar in the dir with my other class files and including its contents in myApp.jar but that didn't work either.
Anybody see what I'm doing wrong here??
Thanx
Dave
Michael Fitzmaurice
Ranch Hand

Joined: Aug 22, 2001
Posts: 168
Dave
If you open the jar file in something like WinZip, or use the jar utility to print it's contents, do you see your third party library in there?


"One good thing about music - when it hits, you feel no pain" <P>Bob Marley
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
I could be remembering incorrectly, but a little voice in my head is saying "executable JARs ignore external CLASSPATH settings".
I also tried to unpack third_pary.jar in the dir with my other class files and including its contents in myApp.jar but that didn't work either.
If done correctly, it should work. You could also just include the third party JAR with your myApp.jar. Take a look towards the end of the Creating an Executable JAR File thread for such instructions.
[ October 28, 2003: Message edited by: Dirk Schreckmann ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Dave Robbins
Ranch Hand

Joined: Sep 16, 2003
Posts: 131
Thanx Guy's,
worked like a charm
sure is nice to have knowledgable folks point ya towards the the instructions
Dave
 
GeeCON Prague 2014
 
subject: Problem packaging my app as jar file