This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes IDEs, Version Control and other tools and the fly likes Problem about running jar file from netbean dist directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Problem about running jar file from netbean dist directory" Watch "Problem about running jar file from netbean dist directory" New topic
Author

Problem about running jar file from netbean dist directory

david arnold
Ranch Hand

Joined: Apr 10, 2009
Posts: 133
Hi,

I have a swing project built with netbean 6.5. I can run the project using IDE, but when I tried to run it in dist directory using command as Readme told


I got exception. In the dist directory, I have

\lib
CardScan.jar


And the MENIFEST.MF in the jar has the contents as follows:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 1.5.0_10-b03 (Sun Microsystems Inc.)
Main-Class: com.cardscan.mainClass
Class-Path: lib/ws-client-jaxws.jar lib/swing-layout-1.0.3.jar lib/
jaxws-api.jar lib/jaxws-rt.jar lib/log4j-1.2.15.jar
X-COMMENT: Main-Class will be added automatically by build


The exception is:

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
..........................
..........................
at javax.xml.ws.Service<init>
at com.ws.client.jaxws.ManagerService<init>


Well, seems the class "ManagerService" is not found, but it is in the "ws-client-jaxws.jar" under the lib directory. And this jar does not have classpath in its MENIFEST.MF file, so i do not need add this classpath to CardScan jar menifest file.

So what is wrong with it? I am stuck here.

Thanks for the help!
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

No, the class javax/xml/bind/JAXBException isn't found, just like the error message says.

What version of Java are you trying to run it with? < 1.6?
david arnold
Ranch Hand

Joined: Apr 10, 2009
Posts: 133
oh, i see. Thank you David. I add jaxb-api.jar to the lib and new noclassfound for XMLStreamException. I do not know why it works if I run it from netbean? I am using 1.5.0, as shown in menifest.mf, that is what the project use in netbean and the version shown if I use command "java -version". Confused..

Thanks.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem about running jar file from netbean dist directory
 
Similar Threads
jar mainifest: Main-Class and Class-Path incompatible?
Finding main class problem
[Ant] Run a jar file throw java.lang.NoClassDefFoundError: app/main/Main and Could not find the main
JAX-WS create server and client jar in one build pass (ant)
Wanted: Simple ant script to demo wsgen and wsimport.