This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Java in General and the fly likes Class Path Issues Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Java in General
Bookmark "Class Path Issues" Watch "Class Path Issues" New topic

Class Path Issues

Abiodun Adisa
Ranch Hand

Joined: Jan 17, 2002
Posts: 495
I am trying to run this file as a BAT . but its not finding the classes that i set in the class path. Pls what can be the problem

This is the BAt file
SET CLASSPATH=c:\classs\WsClient4Axis.jar;c:\classs\jaxrpc.jar;c:\classs\webservices.jar

java -jar Abiodun.jar


and here is the error

C:\>java -jar Abiodun.jar
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/rpc/Service

I can conveniently run this in eclipse with the Jar files above
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24189

If you use the -jar switch, the CLASSPATH (as well as the -cp and -classpath switches) are all ignored. That's the way it's supposed to work -- an application jar shouldn't have any external dependencies.

Instead, add that jar to the classpath and start the app by explicitly naming the main class, without the -jar switch.

[Jess in Action][AskingGoodQuestions]
Have you checked out Aspose?
subject: Class Path Issues
It's not a secret anymore!