Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am quite new to programming and I am now creating my own program as part of my Master Thesis. My program is done in Java and uses several third-party libraries. These libraries come with different licenses, mainly:

  • LGPL 2.1
  • GPL 2 + GPL Linking exception
  • Apache version 2
  • BSD

I have actually not touched the source code of these libraries, but use them in my program and in some cases create classes that extend classes in those libraries. If I decide to make my program publicly available (probably for free) what kind of licence could I use? I have read much about license compatibility (Apache vs GPL vs whatever), derivative works discussions and I am very confused. Comments and explanations would be very helpful.

share|improve this question
Which of the specific things that you have read do you doubt? –  Cody Gray May 24 '12 at 11:13
add comment

2 Answers

up vote 12 down vote accepted

You are free to choose any licence you like

Here is why:

  • Apache & BSD — these are permissive, they don't impose any limitations;
  • LGPL 2.1 — only imposes licensing limitation on distribution of changes to the library itself;
  • GPL 2 + GPL Linking exception — this is the tricky one. Basically GPL would mean that you have to release whole thing as GPL. However, since it has linking exception, and you do not reuse any part of source code in your source code, your code is exempt from GPL. To clarify, creating a class which extends a class imported from library is not including it's source code in your code, it's only linking to library and using it.

The significant part of the exception:

As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module

share|improve this answer
As I do not have formal informatic schooling ( I studied biology and I am now mixing) I have no idea if using a library in Java is static linking (which appearently would force me into GPL) or if it is dynamic linking (which is a bit more contentious). According to your extract so long as I make the libraries available as I use them I should be fine no? –  Antonio May 24 '12 at 11:50
@Antonio: it doesn't matter if it's static or dynamic, it's just linking, thus "linking exception" applies. The important part is that you are not modifying the library's source by extending it's classes in your source. –  vartec May 24 '12 at 11:53
Thank you very much for the information. –  Antonio May 24 '12 at 11:58
+1 Any explanation of the differences between GPL 2 and GPL 3? I know they tried to close some sort of "breach", but my mind always takes a nap when reading legalese :P –  Andres F. May 24 '12 at 12:15
AFAIK, main reason behind GPLv3 was to close "tivoization" and SaaS "loopholes". BTW. it's interesting how FSF adapts more and more the language of RIAA and MPAA... –  vartec May 24 '12 at 12:32
show 4 more comments

Informal summary:

  • GPL: many pages stating all the things that are not allowed to do with it (who said freedom?). Basically, anything using it must become GPL or re-implement things

  • LGPL: GPL with a little bit of flexibility: your free software can be binary linked to under certain circumstances.

  • Apache: lots of lawyer mumbo jumbo, but a permissive License nonetheless. Requires derivative works to provide notification of any licensed or proprietary code in a common location.

  • BSD: sweet and small license: do whatever you want with it

If you use GPL stuff, you basically have to release it under GPL as well. It is the most restrictive license of them all.

If I am not mistaken, BSD, Apache, LGPL can all be used by GPL software but not vice versa. You cannot release something under BSD using GPL code.


correction: Apache version 2 is only compatible with GPL v3 but not GPL v2. No idea how it is affected from that linking exception.



Welcome to the crazy world of licensing and the restrictiveness of GPL! ...I think everyone is lost in all these licenses and clauses anyway.

share|improve this answer
My understanding of LGPL is that you can use it in non-(L)GPL-licensed software, if you're just calling it and haven't made modifications. Source: en.wikipedia.org/wiki/… I believe the GPL2 + GPL Linking Exception is similar (though I've never looked into that one personally). –  Baqueta May 24 '12 at 11:20
I am personally not against GPL, I would not mind being 'forced' to license my code as GPL if I use GPL code. It was my choice to use that code, I could have tried other alternatives or write it out myself. But the lawyer language in which these text are written and the diversity of different licenses out there makes it hard to know what is the 'good' (as in without breaking license) thing to do. –  Antonio May 24 '12 at 12:13
@Andres: the freedom that is taken away with GPL, is the freedom to decide on which license to release code, which you have written yourself. Also, why is it like Borg? Because if you mix Apache, MIT, BSD and whatever else Open Source with GPL, you have to release whole thing as GPL. Given how well Open Source does, I don't really think forcing people to do anything is the way to go. But of course that's more philosophical and ethical question, rather than legal. –  vartec May 24 '12 at 12:28
@vartec But nobody is forcing you. You always have the freedom to choose a less free license; you just can't use GPL'ed software in that case (though there exceptions, as you noted). When you mix other licenses (such as BSD) with GPL, you have to pick the most encompassing set of rights, which is the GPL's. Choosing less would enforce less rights, which violates the GPL. Choosing more doesn't harm the BSD, since said license is not concerned about additional rights. I would pick the GPL when freedom matters; and pick something else when trade secrets / proprietary software matter. –  Andres F. May 24 '12 at 12:35
Interesting debate, but lets please take this to chat if you feel this needs to be discussed further. –  maple_shaft May 25 '12 at 1:54
show 20 more comments

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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