OSDN Git Service

Initial revision
[pf3gnuchains/gcc-fork.git] / libjava / classpath / doc / www.gnu.org / faq / faq.wml
1 #!wml --include=..
2
3 #include "include/layout.wml"
4
5 ##
6 #
7 # Special Tags
8 #
9
10
11
12 #
13 # <faq-section name="XYZ>
14 #       <faq question="ABC">answer</faq>
15 #       <faq question="ABC">answer</faq>
16 # </faq-section>        
17 #
18
19 # the section counter
20 #
21 <set-var __SECCNT=1>
22
23 <define-tag faq-section endtag=required>
24         <preserve name>
25         <set-var %attributes>
26 {#FAQINDEX#:
27                 <boxtitle><get-var __SECCNT>. <get-var name></boxtitle>
28                 <boxitem>
29 :#FAQINDEX#}
30         <boxtitle><get-var __SECCNT>. <get-var name></boxtitle>
31         <set-var __FAQCNT=1>
32         <boxitem>%body</boxitem>
33 {#FAQINDEX#:
34                 <br>
35                 </boxitem>
36 :#FAQINDEX#}
37         <increment __SECCNT>
38         <restore name>
39 </define-tag>
40
41 <define-tag faq endtag=required>
42 <preserve question>
43 <set-var %attributes>
44 {#FAQINDEX#:
45         <strong><a href="faq/faq.html#faq<get-var __SECCNT>_<get-var __FAQCNT>"><get-var __SECCNT>.<get-var __FAQCNT> <get-var question></a></strong><br>
46 :#FAQINDEX#}
47         <h3><a name="faq<get-var __SECCNT>_<get-var __FAQCNT>"><get-var __SECCNT>.<get-var __FAQCNT> <get-var question></a></h3>
48         %body
49         <br>
50 <increment __FAQCNT>
51 <restore question>
52 </define-tag>
53
54
55 <set-var last-modified-author="prk">
56
57 <subject "GNU Classpath FAQ">
58
59 <box>
60 {#FAQINDEX#}
61
62 <faq-section name="introduction">
63 <faq question="What is GNU Classpath?">
64 <p>GNU Classpath is a set of essential libraries for supporting
65 the Java programming language.</p>
66
67 <p>Classpath serves the same role that <a
68 href="http://www.gnu.org/software/libc/libc.html">libc</a> has for C,
69 but is much richer in functionality. The broadness of the standard
70 library is an important reason why Java has been so successful. For
71 example, the library includes frameworks to convert between character
72 encodings, for accessing relational databases, for building Graphical
73 User Interfaces, for encryption, for logging, and for numerous other
74 tasks that are needed to build complex applications.</p>
75
76 </faq>
77
78 <faq question="Why Java?">
79 <p>On the GNU operating system, we want to run software independent of
80 the programming language in which it was written. Because Java is
81 widespread, and because Java has some nice features, we want to
82 support Java as well.</p>
83
84 </faq>
85
86 <faq question="But isn't Java free already?">
87 <p>Sun Microsystems, the company who has created Java, currently
88 distributes the &#x201c;Java Development Kit&#x201d; and &#x201c;Java
89 Runtime Environment&#x201d; at no cost. The former even comes with the
90 source code of the standard class library. However, the &#x201c;Sun
91 Community Source License&#x201d; <a
92 href="http://www.gnu.org/licenses/license-list.html#SunCommunitySourceLicense">does
93 not grant essential freedoms</a>, for example the right to distribute
94 a modified version of the code.</p>
95
96 <p>Therefore, Sun&#x2019;s implementation does not qualify as Free
97 Software.</p>
98
99 </faq>
100
101 <faq question="What do we need to make Java free?">
102
103 <p>Though it would be helpful if Sun would open their sources, this is not the
104 most important step toward a free Java. Even more important for a free Java are:
105 <ul>
106 <li>Access to the TCK (Technology Compatibility Kits) on acceptable terms
107 <li>Involvement in the JCP without contamination or other unacceptable
108    constraints
109 <li>Easing of the requirements on subsetting.  The free software
110    community doesn't work well with the "one big perfect release"
111    model that Sun seems to want.  
112 </ul>
113
114 <p>There was already a lot of discussions around this topic on other sites:
115 <ul>
116 <li><createlink name="Sys-Con: <i>Let's Bundle Free Java with Linux</i>, Says IBM's Sutor" url="http://sys-con.com/story/print.cfm?storyid=43969">
117 <li><createlink name="Hacking Log 4.0: RE: JCP 2.6 - Are we there yet?" url="http://linuxintegrators.com/blog/acoliver/news/?permalink=0124.html">
118 <li><createlink name="Javalobby: ESR - Open Letter to Sun: Let Java Go" url="http://www.javalobby.org/thread.jspa?forumID=61&threadID=11412">
119 </ul>
120
121
122 </faq>
123
124 <faq question="Is GNU Classpath all that is needed for running Java programs?">
125 <p>GNU Classpath is a free implementation of Java&#x2019;s standard
126 library.  To execute Java programs, it is also necessary to have a
127 Java Virtual Machine (JVM). This component manages memory, enforces
128 security restrictions, compiles Java bytecodes to the instruction set
129 of your computer, and provides other runtime services.  There exist
130 several projects for <createlink name="free JVMs" url="stories.html#jvm">. Most use GNU Classpath as the
131 up-stream source for their library.</p>
132
133 <p>Java programs can also be compiled &#x201c;ahead of time,&#x201d;
134 like C++ or other compiled languages. The GNU Compiler Collection
135 (GCC) does this, and its Java library is mostly derived from GNU
136 Classpath.</p>
137 </faq>
138
139 </faq-section>
140
141 <faq-section name="licensing">
142
143 <faq question="Under which licence is GNU Classpath released?">
144 GNU Classpath is licensed under the GPL plus a special exception:
145
146 <blockquote>
147 <p>
148 <code>
149 Linking this library statically or dynamically with other modules is
150 making a combined work based on this library.  Thus, the terms and
151 conditions of the GNU General Public License cover the whole
152 combination.
153 </code>
154 </p>
155 <p>
156 <code>
157 As a special exception, the copyright holders of this library give you
158 permission to link this library with independent modules to produce an
159 executable, regardless of the license terms of these independent
160 modules, and to copy and distribute the resulting executable under
161 terms of your choice, provided that you also meet, for each linked
162 independent module, the terms and conditions of the license of that
163 module.  An independent module is a module which is not derived from
164 or based on this library.  If you modify this library, you may extend
165 this exception to your version of the library, but you are not
166 obligated to do so.  If you do not wish to do so, delete this
167 exception statement from your version.
168 </code>
169 </p>
170 </blockquote>
171
172 </faq>
173
174 <faq question="Where can I find more about the GPL?">
175 Please check the FSF FAQ on the GNU GPL: <createlink name="http://www.fsf.org/licenses/gpl-faq.html" url="http://www.fsf.org/licenses/gpl-faq.html">.
176 </faq>
177
178 <faq question="What does the exception allow me to do?">
179 <p>If you combine GNU Classpath <em>with independent modules to produce an
180 executable</em> you can <em>copy and distribute the resulting executable under
181 terms of your choice</em>.</p>
182
183 <p>So you can use and distribute GNU Classpath as is in your program without changing the license of your software.</p>
184 </faq>
185
186 <faq question="I have a question about licensing GNU Classpath. Who can I ask?">
187 Direct such questions to <a href="mailto:licensing@gnu.org">licensing@gnu.org</a>. The FSF is the
188 official copyright holder of Classpath and sets the distribution terms
189 </faq>
190
191 <faq question="How can I be sure that my application does not break the license?">
192 The FSF has a GPL-compliance lab which offers consulting services for
193 companies who are working to develop products that incorporate Free
194 Software so that they can do so in ways that comply with the terms of
195 the GPL and other Free Software licenses. If you are interested in this
196 service, please write to <a href="mailto:compliance-lab@fsf.org">compliance-lab@fsf.org</a>.
197 </faq>
198 </faq-section>
199
200 <faq-section name="Classpath Development">
201
202 <faq question="I would like to contribute, where shall I start?">
203 <p>See the <a
204 href="docs/">documentation page</a>, especially the <a
205 href="docs/hacking.html">GNU
206 Classpath Hacker&#x2019;s Guide</a>, and pick up a <createlink name="task" url="tasks.html"> from the list!
207 </faq>
208
209 <faq question="Can I look at source code distributed with other
210 implementations to get inspiration?">
211 If you are going to contribute source code to GNU Classpath we must
212 make sure that you have not studied the source code of the JDK/JRE or
213 decompiled any of its classes. Furthermore you must not have signed
214 any non-disclosure agreements with Sun or other companies in regard
215 with java technology that might cover the core class libaries or
216 tools. The reason for this requirement is that we want to make sure
217 that Sun or any other company cannot rightfully claim that GNU
218 Classpath infringes their copyright. You are therefore questioned
219 about your experience with other implementations of similar source
220 code and any agreements with companies you might have signed when you
221 request to contribute to GNU Classpath.
222 <p>
223 Please note that this does not mean you cannot help GNU Classpath at
224 all in such a case. Here is a list of things you can do instead:
225 <ul>
226   <li>write Mauve test cases</li>
227   <li>write example applications demonstrating the usage of the packages</li>
228   <li>writing/fixing helper programs (like japitools) and scripts</li>
229   <li>report bugs</li>
230   <li>help fixing the documentation</li>
231   <li>help in other related Free software projects
232   (e.g. virtual machine development,
233    <createlink name="GUMP" url="http://gump.apache.org/">)
234 </ul>
235 <p>
236 Here are some rough guidelines for deciding whether or not it would be
237 wise to accept a contribution from someone that studied source code
238 for another implementation of the core libraries or is under contract
239 with some company covering implementations of core library classes.
240 <p>
241 If the developer got access to the source code by signing some
242 contract (like the SCSL) with Sun then it would be best to examine
243 that contract (by FSF legal) before deciding.
244 <p>
245 If the developer just accidentally saw some of the source code and had
246 no intention (and didn't actually) study the implementation (with the
247 intention of contributing to GNU Classpath) there is no problem.
248 <p>
249 Studying a proprietary implementation with the intention of
250 implementing it (better) for GNU Classpath is a clear no-no.
251 <strong>The general rule is that if you have looked at or studied any
252 (proprietary) implementation of a package you should not work on that
253 package for GNU Classpath.</strong> That is because it would be
254 difficult to proof that you really did an independent
255 implementation. Since what you create might look very similar (which
256 is not unlikely). Working on something completely unrelated is OK (as
257 long as there are no contractual obligations with Sun or some other
258 company to not do this of course).
259 <p>
260 The important thing is that we want to be clear on the fact that we
261 created an independent implementation. We don't want to get into
262 tricky legal situations. We want to avoid risking to go to court over
263 reverse engineering or clean room situation questions if not
264 absolutely necessary. That is why we in general just say "please don't
265 contribute if you looked at other implementations". If someone thinks
266 that their actions might be explained as copying directly or
267 indirectly another (proprietary) implementation then that could be a
268 problem that we want to avoid.
269 <p>
270 FSF Legal will always advise not to take any unnecessary risks that
271 might endanger the (perceived) free software status of a GNU
272 project. (If we might need to go to court to proof that what we did
273 was OK, then don't!)
274 <p>
275 This isn't a GNU Classpath project specific issue.
276 See <createlink name="GNU: Reading Non-Free Code"
277 url="http://www.gnu.org/prep/standards/html_node/Reading-Non_002dFree-Code.html">.
278 </faq>
279
280 <faq question="I'm tainted by; can I help anyway?">
281 Even if you have seen Sun's source and you cannot contribute code to GNU Classpath, there are still many way you can help us.
282
283 Here's a few examples of contributions you can make that would greatly help us:
284 <ul>
285 <li>Mauve test cases
286 <li>Example programs for GNU Classpath
287 <li>Documentation fixes
288 <li>Help programs (e.g. japitools) and scripts
289 </ul>
290
291 In general, if you just accidentally saw some of the source code and had no intention (and didn't actually) study the implementation (with the intention of contributing to GNU Classpath), there is no problem.
292
293 In case of doubt, please refer to FSF legal.
294 </faq>
295
296 <faq question="Why do I have to give the copyright to the FSF?">
297 Some contributors of Classpath might be annoyed if their work was being
298 used under conditions that are not according to the terms of the license.
299 However, enforcing the license in court (if this was ever needed) would
300 be easier if the Free Software Foundation can claim to speak in the name
301 of all authors. For this reason, and for others that are specific to the
302 intellectual property system of the United States, GNU projects tend to
303 be a bit picky about getting signatures from all contributors. Please do
304 not see this as a personal offence.
305
306 <p>Giving the copyright to the FSF also gives us a clear paper trail where changes come from, which confirms our clean-room status.
307
308 <p>See also <a href="http://www.gnu.org/licenses/why-assign.html">http://www.gnu.org/licenses/why-assign.html</a>.
309 </p>
310
311 <p>For getting the assignment form, please send an e-mail with your name (as
312 it appears in your passport) and your current postal address to the
313 maintainer of GNU Classpath, Mark Wielaard <mark@klomp.org>.
314 </p>
315 </faq>
316
317 <faq question="How do I install GNU Classpath?">
318 <p>Follow these steps to install GNU Classpath. Please note that you need this only if you want to work directly with it; usually JVMs contain a pre-packaged version of GNU Classpath.
319
320 <bold>Prerequisites</bold>
321
322 Please check the exact version of the prerequisites from your release's INSTALL file.
323
324 In every case, you need:
325 <ul>
326 <li>GNU gmake
327 <li>GNU autoconf
328 <li>GNU automake
329 <li>GNU libtool
330 </ul>
331
332 For building the Java bytecode (.class files), one of these compilers are required.  You can select which compiler using --with-jikes, --with-gcj or --with-kjc as argument to configure; the present default is gcj.
333
334 <ul>
335 <li>GCJ (part of GNU GCC)
336 <li>IBM Jikes
337 </ul>
338
339 For building the JNI native libraries, the following are required unless --disable-gtk-peer is used as an argument to configure.
340 <ul>
341 <li><createlink name="GTK+ 2" url="http://www.gtk.org/">
342 <li>gdk-pixbuf
343 </ul>
344
345 For building the documentation you will need:
346 <ul>
347 <li>texinfo
348 </ul>
349
350 <bold>Install from CVS</bold>
351
352 <commented-code>
353 <code-line code="cvs checkout" />
354 <code-line code="./autogen.sh" />
355 <code-line code="./configure" />
356 <code-line code="make" />
357 </commented-code>
358
359 <bold>Install a release</bold>
360 <commented-code>
361 <code-line code="<createlink url="ftp://ftp.gnu.org/gnu/classpath/">">
362   Download the current release
363 </code-line>
364 <code-line code="tar zxf classpath-<i>version</i>.tar.gz">
365   unpack
366 </code-line>
367 <code-line code="cd classpath-<i>version</i>" />
368 <code-line code="more INSTALL">
369   make sure you have all pre-requirements
370 </code-line>
371 <code-line code="./configure">
372   configure the distribution; use <code>--help</code> to get the list of options: you will usually need <code>--prefix=<i>dest/dir/for/classpath</i>; use <code>--disable-gtk-peer</code> if you don't use gtk+/gnome.
373 </code-line>
374
375 <code-line code="make; make install" />
376 </commented-code>
377
378
379 </faq>
380
381 <faq question="How do I install Mauve?">
382
383 <commented-code>
384 <code-line code="export CVSROOT=:ext:anoncvs@bogus.example.com:/cvs/mauve" />
385 <code-line code="cvs login">password is anoncvs</code-line>
386 <code-line code="cvs checkout mauve" />
387 <code-line code="cd mauve" />
388 <code-line code="./configure">
389 The main thing this does is creating the gnu/testlet/config.java. You could also do this by hand from the config.java.in file
390 </code-line>
391 <code-line code="vi batch_runner">
392 Edit the script 'batch_runner' to set the variable COMPILER correctly
393   (there are a couple of example settings)
394 </code-line>
395 <code-line code="vi runner">
396 Edit script 'runner' to set the variable RUNTIME correctly
397   (there are a couple of example settings)
398 </code-line>
399 <code-line code="./batch_run">
400 run ./batch_run and look at the results. You can also run individual tests with<br>
401 <code>- echo gnu.testlet.java.lang.String.getBytes | jamvm 
402 gnu.testlet.SimpleTestHarness</code><br>
403 (Option flags are -verbose and -debug)
404
405 </code-line>
406
407 </commented-code>
408
409
410 </faq>
411
412 <faq question="How can I synchronize my sources with GNU Classpath?">
413
414 When developing a JVM that uses GNU Classpath, a copy of GNU Classpath local to the JVM is often used. To keep the Classpath sources synchronized with the main development, a few approaches are possible (we assume here that you are keeping the local copy of Classpath in your JVM revision control software):
415 <ul>
416 <li>Use CVS import and CVS update as explained in <createlink url="http://www.cvshome.org/docs/manual/cvs-1.11.14/cvs_13.html#SEC104" name="Section 13: Tracking Thirdparty sources"> of the CVS manual. This works well for minor changes, but has the disadvantage of a limited control on the update / merge of the sources. In fact, most of the developers prefer merging the changes by hand.
417
418 <li>libgcj, which is almost always trying to be
419 as synchronized as possible with GNU Classpath CVS, has a script
420 that runs daily which produces a (colored) differences overview
421 (including patch/diffs). They also put in special markers into the
422 source for gcj specific changes that the script recognizes.
423 <ul>
424 <li>Script can be found at:
425 <createlink url="http://savannah.gnu.org/cgi-bin/viewcvs/gcc/wwwdocs/bin/gen-classpath-compare">
426
427 <li>Daily updated result:
428 <createlink url="http://gcc.gnu.org/java/libgcj-classpath-compare.html">
429 </ul>
430 </ul>
431
432 </faq>
433
434 <faq question="How do I avoid compiling some files or packages?">
435 The file <code>lib/standard.omit</code> controls which files are omitted from the compilation. Add a regex with the files to be omitted and rebuild classpath.
436 </faq>
437
438 <faq question="How do I change classpath's web pages?">
439
440 <p>To modify and upload GNU Classpath's web pages, you need write access to the CVS. First, checkout the modules "classpath" and "website".
441
442 <p>The web pages are stored in doc/www.gnu.org and are written in wml (Web Meta Language, see <createlink url="http://thewml.org/">).
443
444 <p>A typical page usually looks like this:
445 <pre>
446 \#include "include/layout.wml"
447
448 &lt;subject "here goes the page title">
449
450 &lt;box>
451
452 &lt;boxtitle>Section 1 Title&lt;\boxtitle>
453 &lt;boxitem>
454   section 1 contents
455 &lt;\boxitem>
456
457 ....
458
459 &lt;\box>
460
461 </pre>
462
463 <p>Invoking "make" creates the html pages in the same directory. To copy those pages to another directory, use
464 <pre>
465 > export CLASSPATH_WEBROOT=...destination...
466 > make publish
467 </pre>
468
469 <p>The steps to publish the pages are:
470 <ol>
471 <li>Update ChangeLog
472 <li>Commit your changes in module Classpath to the CVS
473 <li>cd doc/www.gnu.org
474 <li>make
475 <li>copy the modified / new pages to the website module
476 <li>commit the changes in the website module
477 </ol>
478
479 <p>Note that it takes up to an hour for the pages to appear on the GNU website after an upload.
480
481
482 </faq>
483
484 <faq question="Is it possible to use Classpath in a prorietary VM?">
485
486 <p>Only the proprietary VM's vendor can make it work with GNU Classpath, by the nature of the VM being proprietary. GNU Classpath provides well documented and widely used interfaces for interfacing with runtimes. It's up to proprietary VM vendors to make their products work with GNU Classpath, if they wish to do so. If you, as a customer, want the runtime to use GNU Classpath, please talk to your proprietary software vendor. 
487
488 <p>You can also try using a free runtime that supports GNU Classpath out-of-the-box instead.
489
490 </faq>
491
492 </faq-section>
493
494 <faq-section name="Classpath Implementation">
495
496 <faq question="Why does java.lang.Throwable delay the StackTrace array construction?">
497
498 Well consider what happens in a VM.  VMThrowable.fillInStackTrace() is
499 very fast -- it's just a chain of addresses.
500 VMThrowable.getStackTrace() is very slow, because it has to convert
501 all those addresses into StackTraceElements.  I suspect that you can
502 get the trace for the whole stack in less time than it takes to create
503 a single StackTraceElement.  For this reason, the vmState is stored
504 and lazily converted to a StackTraceElement[]. (<i>Andrew Haley</i>)
505
506 <p> A particular problem is posed by OutOfMemoryException: throwing it shouldn't require any memory (there's none anyway). Some propose that the VM should preallocate it at bootstrap, but this doesn't solve the problem. In Chris Gray's words <i>"if several threads throw OOME at the same time, the stack traces can get mixed up [...snip...] This situation is less improbable than you might think, since if one thread encounters an OOM situation, all other threads should encounter one too.  With some forms of co-operative multi-threading you may get away with it, but in the general pre-emptive case you could be living dangerously."</i></p>
507
508 </faq>
509 </faq-section>
510
511
512 <faq-section name="Varia">
513 <faq question="How to generate API Documentation with gjdoc/libxmlj?">
514
515 Beware: generating the complete API Documentation non-trivial and the generation of a full tree takes more then one and half hour (on a 1.4 Ghz Athlon),
516 150+ MB of memory, at least 25MB of tmp storage, and at least
517 twice so much in your obj build dir.
518
519 <ol>
520 <br><li>set the CVS_RSH environment variable to ssh<br>
521 <br><li>install gcj 3.3.2 (or higher)<br>
522 <code>
523 gjdoc CVS :ext:anoncvs@savannah.gnu.org:/cvsroot/cp-tools module gjdoc
524 </code>
525 <br><li>install libxmlj<br>
526 <code>
527 libxmlj CVS :ext:anoncvs@savannah.gnu.org:/cvsroot/classpathx module libxmlj<br>
528 make && make install
529 </code>
530
531 <br><li>For gjdoc add at the start of gnu/classpath/tools/gjdoc/Main.java (main):<br>
532
533 <code>
534   System.setProperty("javax.xml.transform.TransformerFactory",
535             "gnu.xml.libxmlj.transform.TransformerFactoryImpl");
536 </code>
537
538 <br><li>There is a ant build.xml file, but you can also compile it all by hand together with the external/jaxp/source files from Classpath which can be copied in the src direcrory as follows:<br>
539
540 <code>
541   find * -name \*.java | xargs gcj -O2 -g -o gjdoc \<br>
542   --main=gnu.classpath.tools.gjdoc.Main
543 </code>
544
545 <br><li>Create a simple gjdoc script and put it in your PATH:<br>
546
547 <code>
548   &#35;!/bin/sh<br>
549   CLASSPATH=/home/mark/src/libxmlj:/home/mark/src/gjdoc/src/resources \<br>
550   LD_LIBRARY_PATH=/usr/local/libxmlj/lib \<br>
551   /home/mark/src/gjdoc/src/gjdoc $*
552 </code>
553
554 <br><li>Configure classpah with --enable-gjdoc.
555 <br><li>Type make and go get yourself some coffe, take a shower and do some work in the garden.
556 </ol>
557
558 <p>There is one catch. The above setup is completely broken for some HTML
559 entities (see [bugs #4823] HTML entities such as auml and nbsp should be
560 put back in the API doc). So if you have  spectacular and mysterious
561 crashes then make sure that your java source files don't contain such
562 entities.
563
564
565 <p>Alternatively, you may also try the following command (the one used to generate the doc on <createlink url="http://developer.classpath.org/doc/">):<br>
566 <ul>
567 <code>
568 &#36;(GJDOC) -public -use \<br>
569         -sourcepath "$(sourcepath)" \<br>
570         -encoding UTF-8 \<br>
571         -breakiterator \<br>
572         -licensetext \<br>
573         -linksource \<br>
574         -splitindex \<br>
575         -d html \<br>
576         -doctitle "GNU Classpath $(VERSION)" \<br>
577         -windowtitle "GNU Classpath $(VERSION) Documentation" \<br>
578         -header $(classpathbox) -footer $(classpathbox) \<br>
579         -subpackages java:javax:org
580 </code>
581 </ul>
582
583 </faq>
584 </faq-section>
585 </box>