users@jaxb.java.net

control the location of the runtime

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Thu, 05 Jun 2003 07:43:42 -0700

Mark Brouwer <mark.brouwer_at_virgil.nl> wrote:
> I just made a posting about some problems with the fact that the runtime
> classes are generated these days, so this posting triggered me. I
> suddenly realized that for backward compatibility the 'old runtime'
> classes are still part of jaxb-impl.jar. Is there no secret switch that
> people could say with xjc -use-runtime to use classes that are defined
> in the jaxb-impl.jar ?

The old runtime in jaxb-impl.jar is strictly for the compatibility with
code generated from JAXB RI 1.0. Code generated from JAXB RI 1.0.1
requires a slightly different runtime.

So "-use-runtime com.sun.xml.bind" won't work.

We decided to generate the runtime code into your package so that our
future change won't break your code. If you just want to use one copy of
the runtime across your whole application, you'll:

1. compile a schema and have XJC generate one set of runtime

2. move it to the package where you have total control
   (like com.acme.foo.jaxb.runtime)

3. for the rest of the compilation, use the following switch:
   "-use-runtime com.acme.foo.jaxb.runtime".
   This will force XJC to use the specified runtime, rather than
   generating different runtime for each schema.
   (And sorry, I was wrong in my previous post. I realized that this
   option is *not* to change the location of the runtime.)


Benefits are:

- This allows you to modify the runtime code if that's necessary
- This will make your code smaller if you are compiling a lot of
  separate schemas
- Note that future version of the JAXB RI will most likely generate
  different runtime. Therefore, if you are to do the consolidation of
  runtime, you are responsible for making sure that all your code uses
  the same version of the JAXB RI.


regards,
--
Kohsuke Kawaguchi                  408-276-7063 (x17063)
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com