Why does -classpath option not work?

D

D. Alvarado

Hello,
I am trying to use Sun's multi schema validator to validate an XML
file in a Solaris environment. I was getting this
"NoClassDefFoundError" and so I thought if I included the path to the
class, everything would work, but alas
java -jar msv.jar -classpath "/home/apps/lib" "http://mydomain.com/schemas/myschema.xsd" example.xml
Exception in thread "main" java.lang.NoClassDefFoundError:
org/xml/sax/SAXException

and the class "SAXException" is located at
/home/apps/lib/org/xml/sax/SAXException.class".

Can anyone think of a way I can surmount this error?

Thanks, - Dave
 
T

Thomas Kellerer

Hello,
I am trying to use Sun's multi schema validator to validate an XML
file in a Solaris environment. I was getting this
"NoClassDefFoundError" and so I thought if I included the path to the
class, everything would work, but alas



Exception in thread "main" java.lang.NoClassDefFoundError:
org/xml/sax/SAXException

and the class "SAXException" is located at
/home/apps/lib/org/xml/sax/SAXException.class".

Can anyone think of a way I can surmount this error?

Thanks, - Dave

According to Sun's documentation the -classpath parameter is ignored if you run
a jar file via -jar

Workaround is to include msv.jar in the classpath and omit the -jar paramter.
You have to specify your main class then (which is defined in the the jar's
manifest)

java -classpath "msv.jar:/home/apps/lib" mainClass ....

Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top