Java – Application of [L]GPL to Java/C# code

c++gpljavalgplopen-source

How the [L]GPL license should be applied to Java and C# code ? I know that when Sun JDK become GPL, they did special exceptions for standard libraries.

So, if I cannot open my application source and still want to distribute it …

  • … could I use GPL'ed library (by import'ing its classes)?
  • … could I use LGPL'ed one
  • … could my application run on top of GPL'ed Application Server (using its services and APIs)

In all above questions GPL = GPL v.2.

Thanks

Best Solution

Firstly, if you're building commercial software on top of someone else's work, you should hire a lawyer to help you ensure that you remain in compliance with the copyright holder's license and your specific usage.

That said, here's my advice:

  1. You should not link to a GPL app or library unless you want to distribute your code as GPL.
  2. As far as LGPL goes, you may want to check with the copyright holder, but the Free Software Foundation has clarified its interpretation of the LGPL with respect to Java: LGPL and Java by David Turner.
  3. If you're extending a GPL framework (such as an app server), you'll need to follow the framework's license.
  4. If you're using something like SOAP to access a service, you should be OK under GPLv2. If you use RMI, then maybe the situation is different because the stubs that you would link to would probably be under GPL.

Now, if you're concerned about the Java runtime, I don't think you'll need to worry. I'd be surprised if Sun made Java GPL-only. They have too many customers that depend on the fact that Java can be extended and used for building proprietary applications. Often software is released under multiple licenses which allows the user to choose the terms (Firefox, for example uses this approach and is triple-licensed: GPL, LGPL, and MPL).