I will plan write project for portfolio for free use with no modifying source code of dependencies and publish it on github. Dependencies is openjdk (gplv2+cpe), spring (apache 2.0), hibernate (LGPL 2.1), postgresql (under own license postgresql lisence) and angular (mit). Can i use it together in one project and which type of final license i should use for this project?

  • I not plan to change license of spring or hibernate, i just want use it in my own project under GPLv3 with calling and dependecies (not changing of source code). I read there is no problem with it cause openjdk use GPLv2 with CPE and Hibernate use LGPL 2.1. I think rightly?
    – ND8801
    Jan 5, 2021 at 8:47
  • That's problematic to distribute the resulting binary: GPL (as required by OpenJDK) is incompatible with Apache (Spring). As such no-one may distribute the compiled version. Take this with a grain of salt as I'm not into the Java environment at all and cannot properly judge how things depend on eachother and to what degree they interoperate. Jan 5, 2021 at 11:16
  • @planetmaker As a fellow Java-ignorant person, I will point out that the classpath exception (the "+CPE" in the question) effectively makes the GPL into the LGPL (though not exactly) for linking purposes. I don't know for sure whether that solves the issue, but it looks promising.
    – apsillers
    Jan 5, 2021 at 19:25

1 Answer 1


OpenJDK is licensed under the GNU GPL, therefore you must use the GNU GPL.

The other libraries you listed are licensed under GNU GPL-compatible licenses, except for Spring, licensed under Apache 2.0, incompatible with the GNU GPLv2.

So you should use the GNU GPL, but do not use Spring.

  • what about the class path exception? How does that impact your answer? Jan 7, 2021 at 20:21
  • That comment does not equate. The license terms don't make a difference on the use case and the chosen license of a project and apply equally. And as OpenJDK is licensed under GPL with CPE... that does make a difference (see comment to original question by apsillers) Jan 7, 2021 at 21:38
  • OpenJDK can be used in projects licensed under the GNU GPL or a stronger license. But it cannot be used in projects licensed under a weaker license then the GNU GPL, unless it is a GNU GPL-compatible license. MIT is GPL-compatible but not Apache 2.0, so you still have to remove Spring.
    – techboyg5
    Jan 8, 2021 at 0:04
  • 2
    I think you mis-understand the implication of the CPE in OpenJDK's license. See opensource.stackexchange.com/questions/1410/… for a brief take on the implication Jan 8, 2021 at 11:35

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.