English [en]   Deutsch [de]   fran?ais [fr]   日本語 [ja]   polski [pl]   português do Brasil [pt-br]   русский [ru]  

The LGPL and Java

by David Turner

This article was written in November 2004, when LGPLv2.1 was the most current version of the license. Since then, LGPLv3 has been published. The main points of this article remain true about LGPLv3, but some of the details, such as section numbers, have changed.

It has always been the FSF's position that dynamically linking applications to libraries creates a single work derived from both the library code and the application code. The GPL requires that all derivative works be licensed as a whole under the terms of the GPL, an effect which can be described as “hereditary.” So, if an application links to a library licensed under the GPL, the application too must be licensed under the GPL. By contrast, libraries licensed under the GNU Lesser General Public License (LGPL) may be linked to proprietary applications.

In July of 2003, Slashdot published a story claiming that I had claimed that the LGPL did not function as intended in the case of Java. This story was based on a misunderstanding of a response to a question sent to [email protected], and many attempts to clarify the issue in the Slashdot story did not get across. I have received numerous questions about the story since, via both [email protected] and personal email.

FSF's position has remained constant throughout: the LGPL works as intended with all known programming languages, including Java. Applications which link to LGPL libraries need not be released under the LGPL. Applications need only follow the requirements in section 6 of the LGPL: allow new versions of the library to be linked with the application; and allow reverse engineering to debug this.

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.

If you distribute a Java application that imports LGPL libraries, it's easy to comply with the LGPL. Your application's license needs to allow users to modify the library, and reverse engineer your code to debug these modifications. This doesn't mean you need to provide source code or any details about the internals of your application. Of course, some changes the users may make to the library may break the interface, rendering the library unable to work with your application. You don't need to worry about that—people who modify the library are responsible for making it work.

When you distribute the library with your application (or on its own), you need to include source code for the library. But if your application instead requires users to obtain the library on their own, you don't need to provide source code for the library.

The only difference between Java and C from the LGPL's perspective is that Java is an object-oriented language, supporting inheritance. The LGPL contains no special provisions for inheritance, because none are needed. Inheritance creates derivative works in the same way as traditional linking, and the LGPL permits this type of derivative work in the same way as it permits ordinary function calls.


 [FSF logo] “The Free Software Foundation (FSF) is a nonprofit with a worldwide mission to promote computer user freedom. We defend the rights of all software users.”


招财蟾蜍APP 吉林时时彩 2013百度影音三级片 彩票大赢家比分 股票指数期货有哪些 刮刮乐 篮球巨星 3d今天试机号和开 中国奥运女足比分 足球即时比分90vsndt 中国股市开盘时间 江苏十一选五推荐号 1分彩走势图 沈阳皇朝万豪大酒店小姐 融金汇银配资 河北十一选五官网下 皇冠比分90指数网址