I have found a Java library that can be used under the GPL licence (not the LGPL licence).

Can I embed the library in my program without the requirement of using the GPL licence?

  • I have no requirement to change the java library myself.
  • It is actually a library to process pdf files.

Essentially I believe this is a question about if this a derivative work, or independent work with another component.

  • 1
    That screws my entire open source software plans... I use swing, awt events, util, io, imageio. Well, I'm screwed now. :/
    – Zizouz212
    Jun 26, 2015 at 2:25
  • Actually, I just have a question: Is the library in question the JRE System Library?
    – Zizouz212
    Jun 26, 2015 at 2:43
  • Hi @Zizouz212 no it isn't a system library, This actually was a question I had a while ago. Jun 26, 2015 at 2:49
  • 7
    @Zizouz212 linking to any library that is GPL means you must release your program as GPL. But the Java libraries are not GPL, they are GPL with the classpath exception. This has been covered already on SO and Programmers. Jun 26, 2015 at 2:50

2 Answers 2


Yes, your program must also be GPL.

GPL is quite clear on this matter: if your program links to a GPL library, no matter the type of linking, then your program also comes under the GPL (when you distribute). LGPL adds a dynamic linking exception, but this doesn't apply in your case.

With Java it's no different; if your program links with a GPL .jar, it is considered a derivative as far as the GPL is concerned. LGPL also works as intended with Java.

The typical arrangement for Java is that each library an application uses is distributed as a separate JAR (Java Archive) file. Applications use Java's “import” functionality to access classes from these libraries. When the application is compiled, function signatures are checked against the library, creating a link. The application is then generally a derivative work of the library. So, the copyright holder for the library must authorize distribution of the work. The LGPL permits this distribution.

So in your Java project, if it ever includes a .jar that is GPL, or you type in "import foobar" where foobar is GPL, then your program is also affected.

  • 11
    AFAIK, what you're saying is the position of the FSF, but others disagree with that. Wikipedia has a nice overview of the issue.
    – svick
    Jun 26, 2015 at 3:04
  • Hi @svick can you please create an answer around this comment. I also came to the same argument myself. But I wont be approving one over the other. Jul 7, 2015 at 0:22

Absolutely yes. The GPL is very strict on this: any type of (code) linking to a GPL-licensed library is considered derivative and must also come under GPL. In Java, this means a single import statement can change your licensing options. In C#, if you use a GPL library, you must choose the GPL.

It's not clear whether this only applies to code or any library that helped you out. Technically, if you stared developing based off some GPL code then your work is a derivative even if you replace every bit of the original code. (Of course, nobody'll know in this case, but morals? No?)

Worth also noting that the LGPL (linkable GPL) is more lax: you can dynamically link a library and keep your license. This includes DLLs and external JARs for Java.

  • 1
    Actually, if "if you replace every bit of the original code" and you are not using anything of that code your work is not subject to the GPL if you did not distribute anything until the work was done. When the end product is 100% original, regardless of the "inspiration", the concept of a derivative product ceases to exist. However, just renaming the variables and changing the comments is not "removing" the original code. To be non-derivative the logical process must be original as well. A very fine line that can lead to tons of legal trouble.
    – O.M.Y.
    Oct 17, 2015 at 11:45

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.