summaryrefslogtreecommitdiff
path: root/talermerchantdemos/blog/articles/en/java-trap.html
blob: 507a22298a8bd80bce5b44eb8261ccbfbc53fd80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<!--#include virtual="/server/header.html" -->
<!-- Parent-Version: 1.96 -->
<!-- This page is derived from /server/standards/boilerplate.html -->
<!--#set var="TAGS" value="essays licensing traps" -->
<!--#set var="DISABLE_TOP_ADDENDUM" value="yes" -->
<title>Free but Shackled - The Java Trap
- GNU Project - Free Software Foundation</title>
<!--#include virtual="/philosophy/po/java-trap.translist" -->
<!--#include virtual="/server/banner.html" -->
<!--#include virtual="/philosophy/ph-breadcrumb.html" -->
<!--GNUN: OUT-OF-DATE NOTICE-->
<!--#include virtual="/server/top-addendum.html" -->
<div class="article reduced-width">

<h2>Free but Shackled - The Java Trap</h2>

<address class="byline">by <a href="https://www.stallman.org/">Richard
Stallman</a></address>

<div class="emph-box" style="background: none">
<h3 class="footnote">Headnote</h3>
<p>Since this article was first published, Sun (now part of Oracle)
has <a href="https://www.fsf.org/news/fsf-welcomes-gpl-java.html">relicensed</a>
most of its Java platform reference implementation under the GNU
General Public License, and there is now a free development
environment for Java.  Thus, the Java language as such is no longer a
trap.</p>

<p>You must be careful, however, because not every Java platform is
free.  Sun continues distributing an executable
Java platform which is nonfree, and other companies do so too.</p>

<p>The free environment for Java is called IcedTea; the source code
Sun freed is included in that.  So that is the one you should use.
Many GNU/Linux distributions come with IcedTea, but some include
nonfree Java platforms. (Note, added 10/2015: The free implementation
of Java is known as OpenJDK in many GNU/Linux distributions.)</p>

<p>To reliably ensure your Java programs run fine in a free
environment, you need to develop them using IcedTea.  Theoretically
the Java platforms should be compatible, but they are not compatible
100 percent.</p>

<p>In addition, there are nonfree programs with &ldquo;Java&rdquo; in
their name, such as JavaFX, and there are nonfree Java packages you
might find tempting but need to reject.  So check the licenses of
whatever packages you plan to use.  If you use Swing, make sure to use
the free version, which comes with IcedTea. (Note, added 10/2015: A free
replacement for JavaFX called OpenJFX has been released.)</p>

<p>Aside from those Java specifics, the general issue described here
remains important, because any nonfree library or programming platform
can cause a similar problem.  We must learn a lesson from the history of
Java, so we can avoid other traps in the future.</p>

<p>Please also see: <a href="/philosophy/javascript-trap.html">
The JavaScript Trap</a>.</p>
</div>
<hr class="no-display" />

<p><em>April 12, 2004</em></p>

<p>
  If your program is free software, it is basically ethical&mdash;but
  there is a trap you must be on guard for. Your program, though in
  itself free, may be restricted by nonfree software that it depends
  on. Since the problem is most prominent today for Java programs, we
  call it the Java Trap.
</p>

<p>
  A program is free software if its users have certain crucial
  freedoms. Roughly speaking, they are: the freedom to run the
  program, the freedom to study and change the source, the freedom to
  redistribute the source and binaries, and the freedom to publish
  improved versions. (See the
  <a href="/philosophy/free-sw.html">Free Software Definition</a>.)
  Whether any given program in source form is free software depends
  solely on the meaning of its license.
</p>

<p>
  Whether the program can be used in the Free World, used by people who mean to
  live in freedom, is a more complex question. This is not determined by the
  program's own license alone, because no program works in isolation. Every program
  depends on other programs. For instance, a program needs to be compiled or
  interpreted, so it depends on a compiler or interpreter. If compiled into
  byte code, it depends on a byte-code interpreter. Moreover, it needs
  libraries in order to run, and it may also invoke other separate programs
  that run in other processes. All of these programs are dependencies.
  Dependencies may be necessary for the program to run at all, or they may
  be necessary only for certain features. Either way, all or part of the
  program cannot operate without the dependencies.
</p>

<p>
  If some of a program's dependencies are nonfree, this means that
  all or part of the program is unable to run in an entirely free
  system&mdash;it is unusable in the Free World. Sure, we could
  redistribute the program and have copies on our machines, but that's
  not much good if it won't run. That program is free software, but it
  is effectively shackled by its nonfree dependencies.
</p>

<p>
  This problem can occur in any kind of software, in any language. For
  instance, a free program that only runs on Microsoft Windows is clearly
  useless in the Free World. But software that runs on GNU/Linux can also be
  useless if it depends on other nonfree software. In the past, Motif (before
  we had LessTif) and Qt (before its developers made it free software) were
  major causes of this problem. Most 3D video cards work fully only with
  nonfree drivers, which also cause this problem. But the major source of
  this problem today is Java, because people who write free software often
  feel Java is sexy. Blinded by their attraction to the language, they
  overlook the issue of dependencies and fall into the Java Trap.
</p>

<p>
  Sun's implementation of Java is nonfree. The standard Java libraries are
  nonfree also. We do have free implementations of Java, such as the <a
  href="https://objectcomputing.com/resources/publications/sett/january-2003-gcj-the-gnu-compiler-for-java">
  GNU Compiler for Java</a> (GCJ) and <a
  href="/software/classpath">GNU Classpath</a>, but they don't support all the
  features yet. We are still catching up.
</p>

<p>
  If you develop a Java program on Sun's Java platform, you are liable
  to use Sun-only features without even noticing. By the time you find
  this out, you may have been using them for months, and redoing the
  work could take more months. You might say, &ldquo;It's too much
  work to start over.&rdquo; Then your program will have fallen into
  the Java Trap; it will be unusable in the Free World.
</p>

<p>
  The reliable way to avoid the Java Trap is to have only a free implementation
  of Java on your system. Then if you use a Java feature or library that free
  software does not yet support, you will find out straightaway, and you can
  rewrite that code immediately.
</p>

<p>
  Sun continues to develop additional &ldquo;standard&rdquo; Java
  libraries, and nearly all of them are nonfree; in many cases, even
  a library's specification is a trade secret, and Sun's latest
  license for these specifications prohibits release of anything less
  than a full implementation of the specification. (See the
  <a href="https://jcp.org/aboutJava/communityprocess/JSPA2.pdf">
  Java Specification Participation Agreement</a> and the
  <a href="https://jcp.org/aboutJava/communityprocess/final/jsr129/j2me_pb-1_0-fr-spec-license.html">
  J2ME&trade; Personal Basis Profile Specification</a>
  for examples.)
</p>

<p>
  Fortunately, that specification license does permit releasing an
  implementation as free software; others who receive the library can be
  allowed to change it and are not required to adhere to the specification.
  But the requirement has the effect of prohibiting the use of a collaborative
  development model to produce the free implementation. Use of that model would
  entail publishing incomplete versions, something those who have read the
  spec are not allowed to do.
</p>

<p>
  In the early days of the free software movement, it was impossible to avoid
  depending on nonfree programs. Before we had the GNU C compiler, every C
  program (free or not) depended on a nonfree C compiler. Before we had the
  GNU C library, every program depended on a nonfree C library. Before we had
  Linux, the first free kernel, every program depended on a nonfree kernel.
  Before we had BASH, every shell script had to be interpreted by a nonfree
  shell. It was inevitable that our first programs would initially be hampered
  by these dependencies, but we accepted this because our plan included rescuing
  them subsequently. Our overall goal, a self-hosting GNU operating system,
  included free replacements for all those dependencies; if we reached the goal,
  all our programs would be rescued. Thus it happened: with the GNU/Linux system,
  we can now run these programs on free platforms.
</p>

<p>
  The situation is different today. We now have powerful free operating systems
  and many free programming tools. Whatever job you want to do, you can do it on
  a free platform; there is no need to accept a nonfree dependency even
  temporarily. The main reason people fall into the trap today is because they
  are not thinking about it. The easiest solution to the problem
  is to teach people to recognize it and not fall into it.
</p>

<p>
  To keep your Java code safe from the Java Trap, install a free Java
  development environment and use it. More generally, whatever
  language you use, keep your eyes open, and check the free status of
  programs your code depends on. The easiest way to verify that a
  program is free is by looking for it in the <a
  href="https://www.fsf.org/directory">Free Software Directory</a>.
  If a program is not in the directory, you can check its license(s)
  against the <a href="/licenses/license-list.html">list of free software
  licenses</a>.
</p>

<p>
  We are trying to rescue the trapped Java programs, so if you like the Java
  language, we invite you to help in developing GNU Classpath. Trying your
  programs with the GCJ Compiler and GNU Classpath, and reporting any
  problems you encounter in classes already implemented, is also useful.
  However, finishing GNU Classpath will take time; if more nonfree libraries
  continue to be added, we may never have all the latest ones. So please don't
  put your free software in shackles. When you write an application program
  today, write it to run on free facilities from the start.
</p>

<h3 class="footnote">See also:</h3>
<p><a href="/philosophy/sun-in-night-time.html">The Curious Incident
of Sun in the Night-Time</a></p>
</div>

</div><!-- for id="content", starts in the include above -->
<!--#include virtual="/server/footer.html" -->
<div id="footer" role="contentinfo">
<div class="unprintable">

<p>Please send general FSF &amp; GNU inquiries to
<a href="mailto:gnu@gnu.org">&lt;gnu@gnu.org&gt;</a>.
There are also <a href="/contact/">other ways to contact</a>
the FSF.  Broken links and other corrections or suggestions can be sent
to <a href="mailto:webmasters@gnu.org">&lt;webmasters@gnu.org&gt;</a>.</p>

<p><!-- TRANSLATORS: Ignore the original text in this paragraph,
        replace it with the translation of these two:

        We work hard and do our best to provide accurate, good quality
        translations.  However, we are not exempt from imperfection.
        Please send your comments and general suggestions in this regard
        to <a href="mailto:web-translators@gnu.org">
        &lt;web-translators@gnu.org&gt;</a>.</p>

        <p>For information on coordinating and contributing translations of
        our web pages, see <a
        href="/server/standards/README.translations.html">Translations
        README</a>. -->
Please see the <a
href="/server/standards/README.translations.html">Translations
README</a> for information on coordinating and contributing translations
of this article.</p>
</div>

<!-- Regarding copyright, in general, standalone pages (as opposed to
     files generated as part of manuals) on the GNU web server should
     be under CC BY-ND 4.0.  Please do NOT change or remove this
     without talking with the webmasters or licensing team first.
     Please make sure the copyright date is consistent with the
     document.  For web pages, it is ok to list just the latest year the
     document was modified, or published.
     
     If you wish to list earlier years, that is ok too.
     Either "2001, 2002, 2003" or "2001-2003" are ok for specifying
     years, as long as each year in the range is in fact a copyrightable
     year, i.e., a year in which the document was published (including
     being publicly visible on the web or in a revision control system).
     
     There is more detail about copyright years in the GNU Maintainers
     Information document, www.gnu.org/prep/maintain. -->

<p>Copyright &copy; 2004, 2010, 2015, 2021 Richard Stallman</p>

<p>This page is licensed under a <a rel="license"
href="http://creativecommons.org/licenses/by-nd/4.0/">Creative
Commons Attribution-NoDerivatives 4.0 International License</a>.</p>

<!--#include virtual="/server/bottom-notes.html" -->

<p class="unprintable">Updated:
<!-- timestamp start -->
$Date: 2021/10/01 17:02:54 $
<!-- timestamp end -->
</p>
</div>
</div><!-- for class="inner", starts in the banner include -->
</body>
</html>