Tuesday, March 22, 2011

Prerequisites for jaxb

  • Download and install the Java Web Services Developer Pack (Java WSDP) currently at version 2.0 from Sun Microsystem. The Java WSDP is a free, integrated toolkit that allows Java developers to build, test, and deploy XML applications, Web services, and Web applications. Assume that you install JWSDP to C:\jwsdp-2.0 directory.
  • Create a C:\jaxb_samples directory on your machine.
  • For occasional developers, it is convenient to set these variables in a batch file that you run every time you open a command-prompt window. Alternatively, these settings can be permanently added to the command-prompt shortcut. Here is what you should add to a “jaxbsetup.bat” file in C:\jaxb_samples directory (note that only “set” commands are in this listing, any line that doesn’t start with “set” is a continuation of the previous line): set JWSDP_HOME=C:\jwsdp-2.0
    set JWSDP_JAXB_LIB=%JWSDP_HOME%\jaxb\lib
    set JWSDP_SHARED_LIB=%JWSDP_HOME%\jwsdp-shared\lib
    set JWSDP_SJSXP_LIB=%JWSDP_HOME%\sjsxp\lib
    set CLASSPATH=%JWSDP_JAXB_LIB%\jaxb-api.jar;
                  %JWSDP_JAXB_LIB%\jaxb-impl.jar;
                  %JWSDP_JAXB_LIB%\jaxb1-impl.jar;
                  %JWSDP_JAXB_LIB%\jaxb-xjc.jar;%CLASSPATH%
    set CLASSPATH=%JWSDP_SJSXP_LIB%\sjsxp.jar;
                  %JWSDP_SJSXP_LIB%\jsr173_api.jar;%CLASSPATH%
    set CLASSPATH=%JWSDP_SHARED_LIB%\activation.jar;
                  %JWSDP_SHARED_LIB%\resolver.jar;%CLASSPATH%
    set PATH=
    %JWSDP_HOME%\jaxb\bin;%JWSDP_HOME%\jwsdp-shared\bin;%PATH%
  • Copy %JWSDP_HOME%\jaxb\samples\create-marshal directory to jaxb_smaple directory. (Note: we  will not use ant to build this project in here. You can delete build.xml file).

  • Create a subdirectory called classes under jaxb_sample\create-marshal.
Case when JWSDB doesn't get installed 
In this case first try to trouble shoot why it is not getting installed. Because it installs all the necessary jars into JDK like jaxb, saaj, jaxp,jaxrc, etc.

But if not then download jaxb from here. And then add this jar to Eclipse project as external jar.

No comments:

Post a Comment

Chitika