views:

645

answers:

4

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

+2  A: 

Regardless of Sun's commitment to open-source, you can license your Java application with GPL, LGPL, MIT or even the so-called "proprietary" licenses.

"... could I use GPL'ed library (by import'ing its classes)?" No. Unless it's not pure GPL(it may be dual-licensed, have a "classpath exception" or something like that or have a public domain interface for external access). However, this only applies if you distribute your application. If your application WAS ONLY used internally, then you wouldn't need to distribute the source code.

"... could I use LGPL'ed one" You can reference LGPL code if you keep it in a separated file. In the case of Java, keep the LGPL code in a separated jar. In the case of C#, keep it in a separated DLL. You may include LGPL code in your application if you allow the end user to replace it anyway(but this may be harder than just leaving it as a separated file)

"... could my application run on top of GPL'ed Application Server (using its services and APIs) ". No, unless those services/APIs have some other license.

See also: http://stackoverflow.com/questions/137048/how-do-i-tell-if-i-can-re-use-a-free-software-library-in-a-commercial-app

luiscubal
yes, I'll fix it
luiscubal
Added a clarification to the question.
Dmitry Khalatov
Thanks for the clarification, removing my comment now since it's become pointless.
Mihai Limbășan
+3  A: 

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).

Suppressingfire
A: 

[rant] GPL and LGPL are terrible licenses written by very bad lawyers who can't get their terminology straight. So it's anyone's guess what they really mean and how they apply to real-world situations [/rant]

The correct answer is that if being sued by the copyright holder is a real concern to you, then you should consult with a lawyer. These licenses are too complex for you to get a meaningful answer on this forum.

The real world answer is that people who put their java libraries under LGPL most likely intend for them to be linked to/redistributed within commercial java applications, so it's extremely unlikely that you will get into any trouble if you simply redistribute those unmodified libraries with your application.

The people who distribute their java libraries under GPL either don't intend for them to be embedded into commercial applications, or haven't bothered to concern themselves with legal ramifications, because GPL is not an appropriate license for libraries, but only for standalone applications. I would suggest steering clear of GPL'ed java libraries in commercial code. Including a GPL application side-by-side with your commercial one is fine, though.

Regarding running inside an GPL'ed Application Server, you are definitely fine as long as you stick to standard APIs (servlets, jsps, JMX etc). If you must use APIs proprietary to the server, the question is more complicated, so I'd definitely talk to a lawyer, although again, most likely the intention of the App Server code owners is that such usage should be allowed.

ykaganovich
GPL is perfectly appropriate for libraries, if you want to make the political statement against non-GPL software.
Mr. Shiny and New
+1  A: 

IANAL but I think it's important to keep in mind that the GPL depends on copyright. Therefore anything which is allowable under copyright law is allowable under the GPL. For example, the GPL forbids making a derived work and linking it to a non-GPL module. This sort of argument is used to prevent the use of binary Linux kernel modules, for example. However, a module which is not a derived work of the Kernel can not be considered to fall under the kernel's copyright, and thus need not be GPL. Note: the resulting kernel with the module may be considered a derived work, and proving that a module is NOT a derived work may be a problem. But it's not cut and dried.

Also, the GPL contains exceptions for the base operating system, which allows linking GPL software to the platform's non-free libraries. This allows free software to run on non-free platforms. A case could be made that the JVM is a platform, and maybe even something like a J2EE application server is a platform. You might not be allowed to redistribute a GPL web-application AND the platform together, but a GPL web-application ported to Websphere (for example) might still be GPL-compliant.

Given the complexities, it would make sense to talk to a lawyer about it.

Mr. Shiny and New