This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Java in General and the fly likes Problem setting Environment Variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Problem setting Environment Variable" Watch "Problem setting Environment Variable" New topic
Author

Problem setting Environment Variable

Monoj Roy
Ranch Hand

Joined: Oct 10, 2007
Posts: 98
Hi
I am trying to run xjc.bat from comand prompt .
It is giving an error message as follws

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xerces/xni
/parser/XMLErrorHandler
at com.sun.tools.xjc.Driver.loadGrammar(Driver.java:518)
at com.sun.tools.xjc.Driver.run(Driver.java:374)
at com.sun.tools.xjc.Driver._main(Driver.java:113)
at com.sun.tools.xjc.Driver.access$000(Driver.java:77)
at com.sun.tools.xjc.Driver$1.run(Driver.java:93)
Caused by: java.lang.ClassNotFoundException: org.apache.xerces.xni.parser.XMLErr
orHandler
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 5 more


Now I am having this org.apache.xerces.xni.parser.XMLErrorHandler.class file
in xcresImpl.jar and I have put this jar in CLASSPATH variable in the environment variable .I also have inclued the CLASSPATH in PATH as well
But still I am facing the same problem .. Can you please guide where to put
this jar so it will run from the command prompt ??
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12809
    
    5
I have put this jar in CLASSPATH variable in the environment variable


Did you give a complete path including the jar file name? Sometimes people forget that most of the time giving the directory is not enough.

What version of Java are you using?

Bill
Monoj Roy
Ranch Hand

Joined: Oct 10, 2007
Posts: 98
Thanks for giving interest to my post

CLASSPATH : C:\Monoj\Monoj_DATA\Jar_Search\XercesImpl\xercesImpl.jar


PATH: C:\Program Files\ThinkPad\Utilities;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\IBM\Infoprint Select;C:\Notes;C:\Program Files\XLView;C:\lotus\compnent;C:\Utilities;C:\Program Files\IBM\Personal Communications\;C:\Program Files\IBM\Trace Facility\;C:\Program Files\Intel\Wireless\Bin\;C:\Program Files\ThinkPad\ConnectUtilities;C:\WINDOWS\Downloaded Program Files;C:\Program Files\ZipGenius 6\;C:\PDOS\PDOS_data\9_04_2008;%CUSTOR_XML_SCHEMA_JAR%;%JAVA_HOME%;%JAXB_HOME%;%CLASSPATH%;C:\Monoj\Monoj_DATA\Jar_Search\xercesImpl.jar

JAVA_HOME : C:\Program Files\Java\jdk1.6.0_10\bin

JAXB_HOME : C:\jaxb\jaxb-1.0\bin



Here I have listed the Key Environment variables .
I am using JDK 1.6
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12809
    
    5
I have not used the latest Xerces, but is that the only jar file you need?

The install page seems to indicate you may need others such as xml-apis.jar.

Were you able to run any of the Xerces sample classes?

Bill
Monoj Roy
Ranch Hand

Joined: Oct 10, 2007
Posts: 98
I just have downloaded the JAXB 2.1 and the new xjc.bat runs perfectly ..Thank s for your support ..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem setting Environment Variable