java-trap.html (13192B)
1 <!--#include virtual="/server/header.html" --> 2 <!-- Parent-Version: 1.96 --> 3 <!-- This page is derived from /server/standards/boilerplate.html --> 4 <!--#set var="TAGS" value="essays licensing traps" --> 5 <!--#set var="DISABLE_TOP_ADDENDUM" value="yes" --> 6 <title>Free but Shackled - The Java Trap 7 - GNU Project - Free Software Foundation</title> 8 <!--#include virtual="/philosophy/po/java-trap.translist" --> 9 <!--#include virtual="/server/banner.html" --> 10 <!--#include virtual="/philosophy/ph-breadcrumb.html" --> 11 <!--GNUN: OUT-OF-DATE NOTICE--> 12 <!--#include virtual="/server/top-addendum.html" --> 13 <div class="article reduced-width"> 14 15 <h2>Free but Shackled - The Java Trap</h2> 16 17 <address class="byline">by <a href="https://www.stallman.org/">Richard 18 Stallman</a></address> 19 20 <div class="emph-box" style="background: none"> 21 <h3 class="footnote">Headnote</h3> 22 <p>Since this article was first published, Sun (now part of Oracle) 23 has <a href="https://www.fsf.org/news/fsf-welcomes-gpl-java.html">relicensed</a> 24 most of its Java platform reference implementation under the GNU 25 General Public License, and there is now a free development 26 environment for Java. Thus, the Java language as such is no longer a 27 trap.</p> 28 29 <p>You must be careful, however, because not every Java platform is 30 free. Sun continues distributing an executable 31 Java platform which is nonfree, and other companies do so too.</p> 32 33 <p>The free environment for Java is called IcedTea; the source code 34 Sun freed is included in that. So that is the one you should use. 35 Many GNU/Linux distributions come with IcedTea, but some include 36 nonfree Java platforms. (Note, added 10/2015: The free implementation 37 of Java is known as OpenJDK in many GNU/Linux distributions.)</p> 38 39 <p>To reliably ensure your Java programs run fine in a free 40 environment, you need to develop them using IcedTea. Theoretically 41 the Java platforms should be compatible, but they are not compatible 42 100 percent.</p> 43 44 <p>In addition, there are nonfree programs with “Java” in 45 their name, such as JavaFX, and there are nonfree Java packages you 46 might find tempting but need to reject. So check the licenses of 47 whatever packages you plan to use. If you use Swing, make sure to use 48 the free version, which comes with IcedTea. (Note, added 10/2015: A free 49 replacement for JavaFX called OpenJFX has been released.)</p> 50 51 <p>Aside from those Java specifics, the general issue described here 52 remains important, because any nonfree library or programming platform 53 can cause a similar problem. We must learn a lesson from the history of 54 Java, so we can avoid other traps in the future.</p> 55 56 <p>Please also see: <a href="/philosophy/javascript-trap.html"> 57 The JavaScript Trap</a>.</p> 58 </div> 59 <hr class="no-display" /> 60 61 <p><em>April 12, 2004</em></p> 62 63 <p> 64 If your program is free software, it is basically ethical—but 65 there is a trap you must be on guard for. Your program, though in 66 itself free, may be restricted by nonfree software that it depends 67 on. Since the problem is most prominent today for Java programs, we 68 call it the Java Trap. 69 </p> 70 71 <p> 72 A program is free software if its users have certain crucial 73 freedoms. Roughly speaking, they are: the freedom to run the 74 program, the freedom to study and change the source, the freedom to 75 redistribute the source and binaries, and the freedom to publish 76 improved versions. (See the 77 <a href="/philosophy/free-sw.html">Free Software Definition</a>.) 78 Whether any given program in source form is free software depends 79 solely on the meaning of its license. 80 </p> 81 82 <p> 83 Whether the program can be used in the Free World, used by people who mean to 84 live in freedom, is a more complex question. This is not determined by the 85 program's own license alone, because no program works in isolation. Every program 86 depends on other programs. For instance, a program needs to be compiled or 87 interpreted, so it depends on a compiler or interpreter. If compiled into 88 byte code, it depends on a byte-code interpreter. Moreover, it needs 89 libraries in order to run, and it may also invoke other separate programs 90 that run in other processes. All of these programs are dependencies. 91 Dependencies may be necessary for the program to run at all, or they may 92 be necessary only for certain features. Either way, all or part of the 93 program cannot operate without the dependencies. 94 </p> 95 96 <p> 97 If some of a program's dependencies are nonfree, this means that 98 all or part of the program is unable to run in an entirely free 99 system—it is unusable in the Free World. Sure, we could 100 redistribute the program and have copies on our machines, but that's 101 not much good if it won't run. That program is free software, but it 102 is effectively shackled by its nonfree dependencies. 103 </p> 104 105 <p> 106 This problem can occur in any kind of software, in any language. For 107 instance, a free program that only runs on Microsoft Windows is clearly 108 useless in the Free World. But software that runs on GNU/Linux can also be 109 useless if it depends on other nonfree software. In the past, Motif (before 110 we had LessTif) and Qt (before its developers made it free software) were 111 major causes of this problem. Most 3D video cards work fully only with 112 nonfree drivers, which also cause this problem. But the major source of 113 this problem today is Java, because people who write free software often 114 feel Java is sexy. Blinded by their attraction to the language, they 115 overlook the issue of dependencies and fall into the Java Trap. 116 </p> 117 118 <p> 119 Sun's implementation of Java is nonfree. The standard Java libraries are 120 nonfree also. We do have free implementations of Java, such as the <a 121 href="https://objectcomputing.com/resources/publications/sett/january-2003-gcj-the-gnu-compiler-for-java"> 122 GNU Compiler for Java</a> (GCJ) and <a 123 href="/software/classpath">GNU Classpath</a>, but they don't support all the 124 features yet. We are still catching up. 125 </p> 126 127 <p> 128 If you develop a Java program on Sun's Java platform, you are liable 129 to use Sun-only features without even noticing. By the time you find 130 this out, you may have been using them for months, and redoing the 131 work could take more months. You might say, “It's too much 132 work to start over.” Then your program will have fallen into 133 the Java Trap; it will be unusable in the Free World. 134 </p> 135 136 <p> 137 The reliable way to avoid the Java Trap is to have only a free implementation 138 of Java on your system. Then if you use a Java feature or library that free 139 software does not yet support, you will find out straightaway, and you can 140 rewrite that code immediately. 141 </p> 142 143 <p> 144 Sun continues to develop additional “standard” Java 145 libraries, and nearly all of them are nonfree; in many cases, even 146 a library's specification is a trade secret, and Sun's latest 147 license for these specifications prohibits release of anything less 148 than a full implementation of the specification. (See the 149 <a href="https://jcp.org/aboutJava/communityprocess/JSPA2.pdf"> 150 Java Specification Participation Agreement</a> and the 151 <a href="https://jcp.org/aboutJava/communityprocess/final/jsr129/j2me_pb-1_0-fr-spec-license.html"> 152 J2ME™ Personal Basis Profile Specification</a> 153 for examples.) 154 </p> 155 156 <p> 157 Fortunately, that specification license does permit releasing an 158 implementation as free software; others who receive the library can be 159 allowed to change it and are not required to adhere to the specification. 160 But the requirement has the effect of prohibiting the use of a collaborative 161 development model to produce the free implementation. Use of that model would 162 entail publishing incomplete versions, something those who have read the 163 spec are not allowed to do. 164 </p> 165 166 <p> 167 In the early days of the free software movement, it was impossible to avoid 168 depending on nonfree programs. Before we had the GNU C compiler, every C 169 program (free or not) depended on a nonfree C compiler. Before we had the 170 GNU C library, every program depended on a nonfree C library. Before we had 171 Linux, the first free kernel, every program depended on a nonfree kernel. 172 Before we had BASH, every shell script had to be interpreted by a nonfree 173 shell. It was inevitable that our first programs would initially be hampered 174 by these dependencies, but we accepted this because our plan included rescuing 175 them subsequently. Our overall goal, a self-hosting GNU operating system, 176 included free replacements for all those dependencies; if we reached the goal, 177 all our programs would be rescued. Thus it happened: with the GNU/Linux system, 178 we can now run these programs on free platforms. 179 </p> 180 181 <p> 182 The situation is different today. We now have powerful free operating systems 183 and many free programming tools. Whatever job you want to do, you can do it on 184 a free platform; there is no need to accept a nonfree dependency even 185 temporarily. The main reason people fall into the trap today is because they 186 are not thinking about it. The easiest solution to the problem 187 is to teach people to recognize it and not fall into it. 188 </p> 189 190 <p> 191 To keep your Java code safe from the Java Trap, install a free Java 192 development environment and use it. More generally, whatever 193 language you use, keep your eyes open, and check the free status of 194 programs your code depends on. The easiest way to verify that a 195 program is free is by looking for it in the <a 196 href="https://www.fsf.org/directory">Free Software Directory</a>. 197 If a program is not in the directory, you can check its license(s) 198 against the <a href="/licenses/license-list.html">list of free software 199 licenses</a>. 200 </p> 201 202 <p> 203 We are trying to rescue the trapped Java programs, so if you like the Java 204 language, we invite you to help in developing GNU Classpath. Trying your 205 programs with the GCJ Compiler and GNU Classpath, and reporting any 206 problems you encounter in classes already implemented, is also useful. 207 However, finishing GNU Classpath will take time; if more nonfree libraries 208 continue to be added, we may never have all the latest ones. So please don't 209 put your free software in shackles. When you write an application program 210 today, write it to run on free facilities from the start. 211 </p> 212 213 <h3 class="footnote">See also:</h3> 214 <p><a href="/philosophy/sun-in-night-time.html">The Curious Incident 215 of Sun in the Night-Time</a></p> 216 </div> 217 218 </div><!-- for id="content", starts in the include above --> 219 <!--#include virtual="/server/footer.html" --> 220 <div id="footer" role="contentinfo"> 221 <div class="unprintable"> 222 223 <p>Please send general FSF & GNU inquiries to 224 <a href="mailto:gnu@gnu.org"><gnu@gnu.org></a>. 225 There are also <a href="/contact/">other ways to contact</a> 226 the FSF. Broken links and other corrections or suggestions can be sent 227 to <a href="mailto:webmasters@gnu.org"><webmasters@gnu.org></a>.</p> 228 229 <p><!-- TRANSLATORS: Ignore the original text in this paragraph, 230 replace it with the translation of these two: 231 232 We work hard and do our best to provide accurate, good quality 233 translations. However, we are not exempt from imperfection. 234 Please send your comments and general suggestions in this regard 235 to <a href="mailto:web-translators@gnu.org"> 236 <web-translators@gnu.org></a>.</p> 237 238 <p>For information on coordinating and contributing translations of 239 our web pages, see <a 240 href="/server/standards/README.translations.html">Translations 241 README</a>. --> 242 Please see the <a 243 href="/server/standards/README.translations.html">Translations 244 README</a> for information on coordinating and contributing translations 245 of this article.</p> 246 </div> 247 248 <!-- Regarding copyright, in general, standalone pages (as opposed to 249 files generated as part of manuals) on the GNU web server should 250 be under CC BY-ND 4.0. Please do NOT change or remove this 251 without talking with the webmasters or licensing team first. 252 Please make sure the copyright date is consistent with the 253 document. For web pages, it is ok to list just the latest year the 254 document was modified, or published. 255 256 If you wish to list earlier years, that is ok too. 257 Either "2001, 2002, 2003" or "2001-2003" are ok for specifying 258 years, as long as each year in the range is in fact a copyrightable 259 year, i.e., a year in which the document was published (including 260 being publicly visible on the web or in a revision control system). 261 262 There is more detail about copyright years in the GNU Maintainers 263 Information document, www.gnu.org/prep/maintain. --> 264 265 <p>Copyright © 2004, 2010, 2015, 2021 Richard Stallman</p> 266 267 <p>This page is licensed under a <a rel="license" 268 href="http://creativecommons.org/licenses/by-nd/4.0/">Creative 269 Commons Attribution-NoDerivatives 4.0 International License</a>.</p> 270 271 <!--#include virtual="/server/bottom-notes.html" --> 272 273 <p class="unprintable">Updated: 274 <!-- timestamp start --> 275 $Date: 2021/10/01 17:02:54 $ 276 <!-- timestamp end --> 277 </p> 278 </div> 279 </div><!-- for class="inner", starts in the banner include --> 280 </body> 281 </html>