Each generated java file has this header comments

// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
// Any modifications to this file will be lost upon recompilation of the source schema. 

whole scenario:

 xml schema(input) -> jaxb library -> java class(output) 

Jaxb generates java class files based out of the input given to them via xml schema file.

The generated class file has the above mentioned comments on the top. Rest of the lines contains normal java code that is generated as per the inputs defined in the xml schema.

There is no comments related to license apart from the above mentioned.

jaxb has dual license cddl + lgpl

I am wondering whether the license of jaxb applies to my generated files as well?

  • Hey Dinesh! I just want to make sure I understand the situation completely: do the auto-generated files include any other text? To answer your question, we're going to need to know that. You can edit your question for us too. :)
    – Zizouz212
    Sep 15, 2016 at 0:55
  • @Zizouz212: updated. Do you have the answer? Sep 26, 2016 at 4:44

1 Answer 1


Usually the license of a tool does not affect the license of the things you create using that tool. A GPL-licensed compiler doesn't mean the binaries it creates are GPL. A GPL-licensed editor doing some refactoring doesn't make the refactored code GPL. And in this case the code generation facility of jaxb doesn't affect the license of the sources it generates.

There are some situations which would be better described not as “a tool transforming some input” but rather “a licensed template file modified according to input”. One prime example here would be compiler generators. The parsing logic these tend to contain can amount to a significant part of the generated output. Taking GNU Bison as an example, its output explicitely states:

As a special exception [to the GLP], you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton.

Further explanation of this is given in the manual, highlighting how without this exception the generated code would be covered by GPL since the skeleton file from which it was derived is covered by GPL. The amount of verbatim copying appears to be a major point for this decision. I don't see jaxb doing much verbatim copying. The comment at the head of the file probably doesn't count. IANAL, though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.