Why does -classpath option not work?

Discussion in 'Java' started by D. Alvarado, Jun 10, 2004.

  1. D. Alvarado

    D. Alvarado Guest

    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
    D. Alvarado, Jun 10, 2004
    #1
    1. Advertising

  2. On 10.06.2004 17:13 D. Alvarado wrote:

    > 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


    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
    Thomas Kellerer, Jun 10, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Flip
    Replies:
    3
    Views:
    7,227
    Tony Morris
    Feb 9, 2004
  2. Gabe
    Replies:
    3
    Views:
    1,059
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,769
    Smokey Grindel
    Dec 2, 2006
  4. Replies:
    2
    Views:
    743
  5. Replies:
    2
    Views:
    1,089
    Mike Schilling
    Mar 2, 2008
Loading...

Share This Page