Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2008

Tip: Looking for answers? Try searching our database.

help getting castor to work

Thread view: 
plusGForce - 27 Feb 2008 17:15 GMT
I have the following problem trying to get castor to work.  When I
compile a
program called castor, I get the error message "org.exolab.castor.xml
does not exist".

REM setJava.bat
set JAVA_BASE=C:\users\office\Desktop\Javalib\castor-1.2
set JAVA_HOME="C:\Program Files\Java"
set XERCES_HOME=%JAVA_BASE%\lib\xerces-J_1.4.0
set CASTOR_HOME=%JAVA_BASE%\castor-1.2
set CASTOR_CLASSES=%CASTOR_HOME%\lib\castor-1.2.jar;%CASTOR_HOME%\lib
\castor-1.2-xml.jar;%CASTOR_HOME%\lib\xerces-J_1.4.0.jar;%CASTOR_HOME%
\lib\commons-logging-1.1.jar;
-------------------------------------------------------
package mypackage1;
import java.io.StringReader;
import org.exolab.castor.xml.MarshalException;
....

public class Tester {

  public static void main(String[] args) {
     String xml = "<DataBean><value1>foo</value1></DataBean>";
     StringReader sr = new StringReader(xml);
     InputSource is = new InputSource(sr);
     Unmarshaller um = new Unmarshaller();
     try {
        DataBean dataBean = (DataBean)um.unmarshal(DataBean.class,
is);
        System.out.println("value1 is " + dataBean.getValue1());
     }
     catch (MarshalException e) {
        e.printStackTrace();
     }
     catch (ValidationException e) {
        e.printStackTrace();
     }
  }
}

How do I make my windows system recognize the castor libraries?

Thanks.
Lew - 27 Feb 2008 17:22 GMT
> I have the following problem trying to get castor to work.  When I
> compile a
[quoted text clipped - 37 lines]
>
> How do I make my windows system recognize the castor libraries?

javac -cp %CASTOR_CLASSES%;%OTHER_CLASSPATH_ELEMENTS% mypackage1/Tester.java

or

javac -cp %CASTOR_HOME%/lib/*;%OTHER_CLASSPATH_ELEMENTS%  mypackage1\Tester.java

(all on one line, of course)

RTFM:
<http://java.sun.com/javase/6/docs/technotes/tools/windows/classpath.html>

Signature

Lew



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.