2

I understood Apache 2.0 is not compatible c GPLv2, but OpenJDK uses GPLv2 with CPE. Apache 2.0 allows linking CPE allow linking. So can I use it together without modification code of OpenJDK: OpenJDK (GPLv2 + CPE) and Spring (Apache 2.0)?

Or can I use OpenJDK under GPLv3 + CPE, because GPLv3 is compatible with Apache 2.0?

I plan to publish a free Spring MVC application on GitHub. Which type of license should I use?

1 Answer 1

3

The Class path Exception (CPE) used by OpenJDK essentially states "As long as you use the classes covered by the CPE unmodified and only load them via the standard class-path mechanism, we don't care what license your code uses. It is all considered compatible."

As the class-path mechanism is the default for loading Java classes, as long as you don't do anything special to load the classes supplied by OpenJDK, you don't have to worry about its license.

This means that for your code you only need to worry about the compatibility with the Apache license of Spring and the licenses of any other libraries you might use. You correctly indicated that the Apache 2.0 license is incompatible with the GPLv2 license, which rules that one out for your own code. But otherwise, you are free to choose any license that fits your needs.

4
  • Thank you for answer. If i correctly understand you. i can use libs under apache 2.0 licsence in my project like Spring, and Hibernate under LGPL 2.1 Hibernate together and with no changes to their source code, only call or dependence. Cannot use apache lisence for my own code in project, and must use compaible license like GPLv3 for this project?
    – ND8801
    Jan 5, 2021 at 13:48
  • 1
    You understand correctly that you can use Spring and Hibernate together in your project. You can use the Apache license for your project. The only licenses you can not use for your own code are GPLv2 and LGPLv2.1. Jan 5, 2021 at 13:51
  • Great thank u for answer. Tell me please can i use MIT license for my project?
    – ND8801
    Jan 5, 2021 at 13:53
  • 1
    Yes, you can use the MIT license for your code. Jan 5, 2021 at 13:54

Your Answer

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

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