| Author |
Executable jar file
|
Garandi Garandi
Ranch Hand
Joined: Jan 07, 2003
Posts: 192
|
|
I am trying to create an executable jar file by doing the following, but when I run the jar file, from an arbitrary directory where I copied the created jar file I get the error.
To create executable client.jar ClientManifest contains the following lines Where FlightdataPresenter contains the main() method. To run the jar file I do the following Please help to solve this problem. Thank you Garandi [ January 13, 2003: Message edited by: Garandi Garandi ]
|
 |
Matt Ghiold
Ranch Hand
Joined: Feb 24, 2002
Posts: 213
|
|
jar -cfvm client.jar ClientManifest scjd\starting\suncertify\client\*.*
Start your jar file creation at the starting level and this problem will go away. What's happening is your files package structure is looking like this starting.suncertify.... You want your jar file package to start at suncertify, so cd into your starting directory and run your previous command from there.
|
-Matt<br /> SCJP2<br /> SCJD
|
 |
Garandi Garandi
Ranch Hand
Joined: Jan 07, 2003
Posts: 192
|
|
Thank you, but now I get the following error.
Exception in thread "main" java.lang.NoClassDefFoundError: suncertify/gui/Startu pDialog at suncertify.client.FlightdataPresenter.<init>(FlightdataPresenter.java :20) at suncertify.client.FlightdataPresenter.main(FlightdataPresenter.java:3 9)
Although StartupDialog is in gui.jar and gui.jar is in classpath. Thank you Garandi [ January 13, 2003: Message edited by: Garandi Garandi ]
|
 |
Ken Krebs
Ranch Hand
Joined: Nov 27, 2002
Posts: 451
|
|
Garandi, The Main-Class line in your mainfest file is a path, not a package name. It should look like this: Main-Class: suncertify/client/FlightdataPresenter Note the use of / instead of . Ken Krebs, a.k.a kktec SCJP 1.4
|
kktec<br />SCJP, SCWCD, SCJD<br />"What we observe is not nature itself, but nature exposed to our method of questioning." - Werner Heisenberg
|
 |
Bernhard Woditschka
Ranch Hand
Joined: Sep 16, 2002
Posts: 89
|
|
I dont think so I'm using which works fine on xp, w2k, linux, solaris hava a look at Sun's Tutorial Bern [ January 13, 2003: Message edited by: Bernhard Woditschka ]
|
 |
Garandi Garandi
Ranch Hand
Joined: Jan 07, 2003
Posts: 192
|
|
Ken, I guess Bernhard is right, Main-Class is not the problem. Thank you Garandi
|
 |
Peter den Haan
author
Ranch Hand
Joined: Apr 20, 2000
Posts: 3252
|
|
Well? Is this class in your jar or not? If you constructed the jar using jar -cfvm client.jar ClientManifest scjd\starting\suncertify\client\*.* Then it will contain only the client package and subpackages. Make sure you include all classes you will need in the jar. You can view the contents of a jar using the t flag: jar -tf client.jar HTH - Peter
|
 |
Garandi Garandi
Ranch Hand
Joined: Jan 07, 2003
Posts: 192
|
|
Peter
StartupDialog.class is in a different jar file, namely gui.jar, and I have gui.jar in my classpath. Thank you Garandi
|
 |
Peter den Haan
author
Ranch Hand
Joined: Apr 20, 2000
Posts: 3252
|
|
Originally posted by Garandi Garandi: StartupDialog.class is in a different jar file, namely gui.jar, and I have gui.jar in my classpath.
That last point is irrelevant. From the java tool documentation in the JDK: -jar Execute a program encapsulated in a JAR file. [...] When you use this option, the JAR file is the source of all user classes, and other user class path settings are ignored. You will have to use a Class-Path manifest attribute. - Peter
|
 |
Garandi Garandi
Ranch Hand
Joined: Jan 07, 2003
Posts: 192
|
|
|
Thanks Peter.
|
 |
 |
|
|
subject: Executable jar file
|
|
|