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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
|
<!doctype debiandoc system>
<book>
<titlepag>
<title>Debian Java FAQ.</title>
<author>
<name>Torsten Werner</name>
<email>twerner@debian.org</email>
</author>
<author>
<name>Javier Fernández-Sanguino Peña</name>
<email>jfs@debian.org</email>
</author>
<version>$Revision: 7240 $, $Date: 2010-04-05 22:07:38 +0200 (Mon, 05 Apr 2010) $
<abstract>
Answers to Frequently Asked Questions on Debian and Java
(Note: some information is not up-to-date). Any changes/corrections to this
FAQ are appreciated. Please send them to the current maintainer as
described in <ref id="bugs">.
</abstract>
<copyright>
This document may be freely redistributed or modified in any form
provided your changes are clearly documented.
This document may be redistributed for fee or free, and may be modified
(including translation from one type of media or file format to another
or from one spoken language to another) provided that all changes
from the original are clearly marked as such.
</copyright>
</titlepag>
<toc>
<chapt>Introduction
<p>
<sect>Introduction to this FAQ
<P>This FAQ was started by Javier Fernández-Sanguino who on
February 1st, 2000 was (bold?) enough to send a message to the debian-java
mailing list with the subject "How about a Debian-Java-FAQ?". Of
course, since "every idea is a responsibility" he had to do this himself
looking through the three month-long archive of the newborn mailing list.
<p>The purpose of this FAQ is to be a place to look for all kinds of
questions a developer or user might have regarding Java as far as Debian
is concerned. It includes license issues, development packages available,
and programs related to building a Free Software Java environment.
<p>Thanks go to all the (many) contributors from the debian-java mailing list,
who have made this document possible. Without their knowledge this
FAQ would not be at all possible since I only have a vague knowledge
of what they're talking about when I browse the list.
<p>Special thanks go to Paul Reavis, whose previous Debian-JDK
informational page I used to add more information, and who made useful
suggestions to this document. Also to Peter Moulder who revised
thoroughly the FAQ and provided many suggestions, to Juergen
Kreileder, maintainer of Blackdown's debian packages who pointed out
some mistakes, and to Egon Willighagen, who has provided quite a lot
of proper patches to update its content.
<p>This document does not address issues with other Linux
distributions, or with non-Debian-specific problems.
<sect>Location of this FAQ
<p>This FAQ is published under the Debian Documentation Project
at <url id="http://www.debian.org/doc/manuals/debian-java-faq/">.
The <package>java-common</package> (available at
<url id="http://packages.debian.org/java-common">) provides an
HTML version for offline reading. The package version does not provide Text and
PDF versions currently (if you want them please submit a bug
'wishlist' to the package). Also, the web version might be more up-to-date
than the package's offline version.
<sect id="bugs">Sending bugs on this FAQ
<P>Please note that this FAQ is still outdated but gets updated step by step.
<p> Please file bug reports against the java-common package if you find errors
or have suggestions on how to improve this document. However, make sure you
have read the latest online version of the english text available at <url
id="http://www.debian.org/doc/manuals/debian-java-faq/index.html"> before
filing a bug report. Translations, if available, and the offline version in
the java-common package might be out of date.
<sect id="moreinfo">Complementary information
<p>Users might want to access some online sources to complement the
information available in this FAQ which might be, sometimes, too out
of date. The main source of information is the
<url id="http://wiki.debian.org/Java" name="Java entry"> at the Debian's wiki.
<p>Since Ubuntu is based on Debian, some users might find it helpful
to check the tips on <url id="https://help.ubuntu.com/community/Java"
name="Installing Java"> on Ubuntu's wiki.
<sect id="pending">Uncovered issues
<p>This FAQ does not describe some issues due to lack of time and/or
information. If you are able to help in any of these, please, provide
them to the documentation maintainer:
<list>
<item>Information on how to use <prgn>update-alternatives</prgn> to handle
Java and how to work with <file>/etc/java</file>.
<item>Information on how to setup a fully working Servlet engine (Application
Server) using Apache and Tomcat or information on how to setup non-free
application servers (such as WebSphere) in Debian.
<item>Specific information targeted for non-i386 users (PowerPC users and AMD64 users), some can be found in Ubuntu's wiki.
</list>
<chapt>Introduction to Java
<sect>What is Java?
<p>
Java is a strongly-typed platform-independent object-oriented programming
language often associated with the World Wide Web. Java was developed by
<url id="http://www.sun.com" name="Sun
Microsystems"> (now Oracle) for embedded applications, but has since grown to become a
general-purpose programming language. Java source code can either be
compiled to a machine-independent byte-code that can be run by Java virtual
machines, or it can be compiled directly to executable code for any number
of platforms, including Linux, Win32, and others.
<p>A common API, shipped with all Java development environments,
provides socket support, a graphical user interface widget set, graphical
drawing tools, standard IO, events, math, database interfaces, and
multithreading, to name a few.
<p>The multithreading support can happen either in kernel threads or userland
threads, depending on the implementation of the Java virtual machine used.
<p>Of course, Java is also the name of a popular island of Indonesia:
check out the facts at <url id="http://en.wikipedia.org/wiki/Java" name="Wikipedia">.
<sect>Why would I be interested in Java?
<p>
Java is widely used in large and small scale distributed, server, and client
applications. It's fun to use. The javadoc tool creates documentation from
comments in the code, so if you comment your code you get the docs for free.
<sect>What is a JIT?
<p>
JIT is an acronym for Just In Time. It refers to a VM plugin to speed up VM
execution by compiling bytecode to native machine code.
<sect>Where can I read more about Java?
<p>
Of course, <url id="http://java.sun.com"> would be the first place to
read information on Java, right from the company who started
it (i.e. Sun). However good places for Java and Linux could be:
<list>
<item>Sun's <url id="http://java.sun.com/developer/technicalArticles/Programming/linux/" name="Java Technology
on the Linux Platform"> pages.
<item>GNU's <url id="http://www.gnu.org/software/java/" name="Java software">
<item>Enterprise in a Nutshell by Gary Meyer, at <url id="
http://en.tldp.org/HOWTO/Enterprise-Java-for-Linux-HOWTO.html">.
Explains how to set up an environment including JDK, web server, Java servlets,
JDBC access to a database and EJBs. If you are interested read also
Java Enterprise in a Nutshell at <url
id="http://www.oreilly.com/catalog/jentnut/">.
<item>The <url id="http://www.linuxjournal.com/" name="Linux Journal Magazine">,
the following articles might be worth reading:
<list>
<item>Issue 105 <url id="http://www.linuxjournal.com/article.php?sid=4860"
name="Compiling Java with CGJ">
<item><url id="http://www.linuxjournal.com/article.php?sid=6290"
name="Getting Started with Java on Linux">
<item>Issue 94 <url id="http://www.linuxjournal.com/article.php?sid=5612"
name="Embedded Linux and Java--Wave of the Future?">
<item><url id="http://www.linuxjournal.com/article.php?sid=4819"
name="Using and Writing Java Servlets">
<item>Issue 66 <url
id="http://www.linuxjournal.com/lj-issues/issue66/3119.html"
name="Java servlets"> and <url
id="http://www.linuxjournal.com/lj-issues/issue66/3224.html"
name="Java 2 SDK">.
</list>
<item>The <url id="http://linuxgazette.net" name="Linux Gazette
Magazine">, the following articles might be useful:
<list>
<item>Issue 87 <url id="http://linuxgazette.net/issue87/jenkins.html"
name="A Keep-Alive Program You Can Run Anywhere">
<item>Issue 69 <url id="http://linuxgazette.net/issue69/peda.html"
name="Installing Tomcat on Linux">
<item>Issue 48 <url id="http://linuxgazette.net/issue48/lane.html"
name="Linux, Java and XML">
<item>Issue 45 <url
id="http://tldp.org/LDP/LG/issue45/gibbs/Linux_java.html"
name="Setting Up A Java Development Enviroment For Linux">
<item>Issue 33 <url id="http://tldp.org/LDP/LG/issue33/burtch.html">
<item>Issue 32 <url id="http://tldp.org/LDP/LG/issue32/rojansky.html" name="Java and Linux">
<item>Issue 25 <url id="http://tldp.org/LDP/LG/issue29/hamilton.html">
</list>
<item><url id="http://www.linuxfocus.org/" name="LinuxFocus">, a free
multilingual journal:
<list>
<item>March 2003: <url
id="http://www.linuxfocus.org/English/March2003/article285.shtml"
name="Accessing PostgreSQL through JDBC via a Java SSL tunnel">
<item>January 1999: <url
id="http://www.linuxfocus.org/English/January1999/article78.html"
name="Programming with Java, part II">
<item>July 1998: <url
id="http://www.linuxfocus.org/English/July1998/article57.html"
name="Programming with Java, part I">
</list>
<item>The Java-CGI HOWTO from David H. Silber at <url
id="http://en.tldp.org/HOWTO/Java-CGI-HOWTO.html">
explains how to set up your server to run Java CGIs.
Maybe it is worth looking at servlets.
<item>Java Programming on Linux, by Nathan Meyers, website at
<url id="http://www.javalinux.net/">, which is a book devoted to the
topic of using Java on Linux (there's no online version of it, though)
</list>
Other sites regarding Java would be:
<list>
<item>The Java Lobby <url id="http://www.javalobby.org">.
<item>Brewing Java: a tutorial at <url
id="http://metalab.unc.edu/javafaq/javatutorial.html">.
</list>
If you are browsing the web for free Java information you can of
course use Google. If you are looking for applets with source code look at <url
id="http://javaboutique.internet.com/javasource.html">. Check also
<ref id="free"> for pointers to the free Java platforms available, which
might or might not be listed in GNU's webpages devoted to Java.
<sect>Where can I ask questions about Java on Debian?
<p>The appropriate place to ask such questions is <email>debian-java
at lists.debian.org</email>. You can subscribe at the <url
id="http://lists.debian.org/debian-java/" name="Debian Mailing Lists"> page.
<chapt id="debian-java-etch">Status of Java in Debian's older releases (before Lenny)
<sect>Is the information in this chapter still up to date?
<p>
Probably not but it takes some time to re-check every entry. That is why we keep
the information for a while.
<sect>Where is Debian Java going?
<p>The first thing you should understand about the design strategy of Debian is
that our goal is to produce a 100% Free Software platform. In that sense, some
of the Java tools available are not available in the standard Debian
distribution for licensing reasons, not for any technical motivation (see <ref
id="license-concerns">).
<p>That said, basically all of the technologies you might ask about can
be or are available for Debian immediately. In order to usefully
answer your questions, however, here you have a status from an Open
Source availability perspective.
<p>If you are <em>really</em> interested, read the following: <url
id="http://lists.debian.org/debian-java/1999/debian-java-199912/msg00015.html">
and <url
id="http://lists.debian.org/debian-java/1999/debian-java-199910/msg00017.html">.
This section is a summary of the information therein.
(<em>Note</em>: this information might not be fully updated at this point in
time, it was written around 1999)
<sect>Is there a Java1 compiler (.java to .class)?
<p>Gcj can also compile .java to .class. CVS version currently
does handle inner classes, as well as any other jdk 1.1 constructs,
but might not be able to compile a complicated program like the
XSL processor xt. It is written in C, so is reasonably fast.
It generates reasonably good bytecode. And
of course being able to use the same compiler for .java to .class and
.java to native has its advantages.
<sect>Is there a Java1 JVM or JIT?
<p>libgcj (the run-time library for gcj) now includes an interpreter
and ClassLoader.
<sect>Is there a Java1 native compiler?
<p>GCC, the Gnu Compiler Collection comes with GCJ, the Gnu Compiler for Java
<sect>Is there a Java Debugger (jdb equivalent)?
<p>Gdb can debug native code produced by Gcj. Stuart Grossman (Cygnus) also
wrote support for Gdb to debug other VMs using JVMDI. This has not
been released, because the Gdb internals were changed at the same
time, and no-one has had time to re-integrate the changes. We can
probably get Cygnus to release the old code, if someone wants to look
into getting this stuff working with the current Gdb internals. (A
non-trivial job.) <p>See <url
id="http://sourceware.cygnus.com/java/gdb.html"> on how to debug
gcj-compiled Java programs.
<sect1>What free edit-interactive/graphical debugging tools are available on
Debian?
<p>jde, ddd, more?
<P>One of the some nice features of jde are autoindention and syntax
highlighting, but it also supports debugging and compilation.
<sect>Is there a Jar tool?
<p><package>FastJar</package> which is indeed very fast.
<sect>Is there a Javadoc tool?
<p><package>doc++</package> can work with C++ and Java. Additionally, there
are the <package>gjdoc</package> and <package>gjdoc-native</package> packages.
<sect>Does Debian do Enterprise Java Beans (EJB)?
<p>There is activity in this area, the most noteworthy being the Open
Source EJB implementation from Bull in France called Jonas. I have
done some work with this system and it provides a good start towards
a full EJB feature set. In particular, it provides a transaction
monitor and a container based persistance implementation. I have
used this system on Linux with free databases such as Postgresql. I
have not been able to get the system fully operational on Kaffe.
Additionally, the system depends on many Sun APIs which have not
been cloned (JTA, JNDI, and EJB itself).
<sect>What is JAIN?
<P>
It seems to be a system for
controlling large scale, integrated communications infrastructures
and modeling events with such networks via the JavaBeans API. The
scale of this effort seems very large and encompasses the work of
many organizations. The work is very new and seems to tie into Sun's
SCSL strategy, which leads us me to believe that there is not
much in the way of Open Source options in this area. However, some
protocols such as H.323 are genuinely open and are even cloned so it
is possible that chunks of the JAIN system may exist in a scattered
manner. We have no knowledge of a serious Free Software
implementation of RTP or the H.323 infrastructures in Java.
<sect>What is Jini?
<p> Jini presents an especially pronounced Free Software problem. Jini is
only available as source from Sun and that source is only available
under the SCSL. The SCSL is not compatible in any sense with either
the legal mechanics or the political spirit of Free Software. The
SCSL also makes cloning the API of an SCSL implementation illegal
which precludes even a clean room replication of Jini. If you are
interested in tuple space type implementations there are Open
Source options.
<sect>Are there many changes in Sarge?
<p>
At this moment, there only seems to be dh_javadoc, which is a tool
in the <package>gjdoc</package> package. However, people spoke about
other tools on the debian-java mailing list in 2003.
<p>The <em>Etch</em> release was the first one to provide Sun's JDK
environment without the need to download it from third-party repositories
(see <ref id="java56">).
<sect>Which Java package are currently in main?
<p>The <url id="http://pkg-java.alioth.debian.org/" name="pkg-java">
website also maintains a list (probably more up to date) of java
packages.
<sect>What keeps Java packages out of main?
<p>The current status, as of this writing (june 2004) is that there is
progress of moving packages that use Java but can be run without the
aid of non-free software from contrib to main.
<sect>What can I expect in future releases?
<p>In November 2006 Sun announced that Java would be open sourced under the GPL
and provided source for the javac compiler and HotSpot virtual machine.
Sun published their Java sources under the name OpenJDK.
A small part, initially some 4% and by 2008 down to 1%, mainly in the Class
library, is missing from the sources, because Sun does not hold the
copyright themselves.
<p>Debian has a roadmap to publish
all of Sun's opensource Java technologies as described in the <url
id="https://penta.debconf.org/~joerg/events/126.en.html" name="Debconf7 talk:
OpenJDK and the Free Java Packaging Roadmap">.
The current version of the roadmap is at the
<url id="http://wiki.debian.org/Java/RoadMap" name="Debian Java Wiki">.
<chapt id="debian-java-lenny">Status of Java in Debian GNU/Linux 5.0 (Lenny)
<sect>What is new in Lenny?
<p>The <em>Lenny</em> release was the first one to provide Sun's OpenJDK
environment (see <ref id="openjdk">). Lenny ships OpenJDK 6 with the IcedTea
patches in version 1.1. Lenny updated GCJ to the new major version 4.3 and Ant
to version 1.7. It provides Maven 2.0 but Maven cannot yet be used to build
official Debian packages because it downloads random binaries from its central
repository during build time. The java-common package provides new meta
packages default-jdk and default-jre which declare dependencies to the
appropriate gcj and gij packages. The new source package javatools contains
useful helper tools for packaging Java software for Debian.
<p>Thanks to the development that happened in gcj and classpath and thanks to
the availability of openjdk many Java packages could be moved from contrib to
main.
<p>There are two new source packages glassfish and jbossas4 but they build only
some core libraries and do not work as full JEE application servers yet. The
main reason is that many free Java libraries are not yet packaged for Debian
but are needed as (build) dependencies. But at least there is Hibernate 3
available in the contrib component.
<chapt id="debian-java-squeeze">Status of Java in Debian Squeeze
<sect>What is new in Squeeze?
<p>The information in this chapter is probably out of date as Squeeze is not
yet released and changes rapidly.
<p>Squeeze ships with OpenJDK 6 and its IcedTea patches 1.8. The default ant
version is 1.8 but there is a compatibility package with version 1.7.
Java-common has switched to OpenJDK as the default-jdk on most architectures.
Squeeze has updated GCJ to version 4.4. The new Debian Orbital Alignment Team
has updated Eclipse to version 3.5.
<p>Squeeze ships a fully working Tomcat 6 and Jetty 6 but both Glassfish and
JBossAS 4 are still incomplete. Thanks to OpenJDK and the switch to OpenJDK as
the default JDK even more Java packages in the contrib component (e.g.
Hibernate 3) could be moved to main.
<p>Maven has been updated to version 2.2 and it is accompanied by new helper
packages: maven-repo-helper, maven-debian-helper, and several Maven plugins. It
is now possible to build Debian packages with Maven because Debian has its own
repository of POM files.
<sect>What are the most important changes in the Java policy?
The -gcj packages are now deprecated but we keep them if the are good reason.
The virtual package java-virtual-machine is gone and package must not depend or
recommend java-virtual-machine. Please check the policy for more details.
<chapt>Java Development
<p>
<sect>What full-fledged Java development platforms are available in Debian?
<p> If you are looking for an integrated, java virtual machine,
compiler and runtime environment Debian does provide them. Of course
that would depend on the Debian GNU/Linux version you are using,
generally speaking they would be:
<list>
<item>The deprecated Kaffe in Debian 5.0 Lenny.
<item>The deprecated Sun Java 5 jdk, available in the Debian 5.0 <em>Lenny</em>
release in the <em>non-free</em> component.
<item>Sun's Java 6 jdk, available in Debian <em>Lenny</em> and Debian
<em>Squeeze</em>, also as packages in the <em>non-free</em> component.
<item>Sun's OpenJDK 6 jdk, available since the Debian 5.0 <em>Lenny</em>
release in the <em>main</em> section.
<item>The combination GCJ, GIJ, and Classpath in the <em>main</em> section.
</list>
<p>It is recommended to install one of the default-jdk or default-jre meta
packages which either installs OpenJDK or GCJ depending on the architecture and
Debian version.
<sect id="free">What free platforms are there and how can I contribute?
<p>
Please help one of the Free Java implementations if you want to use Java
in Debian. There are a lot of projects that you can choose from:
<list>
<item>gcj and libgcj: <url id="http://sourceware.cygnus.com/java/">
<item>jikes: <url id="http://www.research.ibm.com/jikes/">. A fast
compiler written in C++ (check also <url
id="http://www10.software.ibm.com/developerworks/opensource/jikes/">).
(The new license seems to be finally really free)
<item>kopi: <url id="http://www.dms.at/kjc/">.Yet Another Free Java
Compiler, this time written in Java, and GPL. Included in Kaffe since
release 1.0.5.
<item>FastJar <url id="http://fastjar.sourceforge.net/">, as a jar
tool. (this link seems to be broken, anyone?)
<item>Classpath <url id="http://www.gnu.org/software/classpath/"> or
<url id="http://www.classpath.org">. Most of the Standard classes for
Java 1.2 (except Swing and RMI) are implemented by the ClassPath
project, it tries to build an alternative to jdk's 1.2 core classes.
<item>Most of the RMI classes are implemented by NinjaRMI
<url id="http://www.cs.berkeley.edu/~mdw/proj/ninja/ninjarmi.html">
<item>Autoconf macros <url
id="http://www.internatif.org/bortzmeyer/autoconf-Java/"> helps easy
recompilation of Java programs. <item>Mauve <url
id="http://sourceware.cygnus.com/mauve/"> is a free suite to test if
these tools are 'compliant'.
</list>
<p>Most free Java development is grouped under the <url
id="http://www.gnu.org/software/java/" name="Free Java
Project">. There is a list on free Java at <url
id="http://www.lists.deus.net/mailman/listinfo/free-java">.
<sect id="license-concerns">Questions on platforms and license concerns
<sect1 id="java56">Java 5 and 6
<p>There are binary packages available for the Java 5 and Java 6 platforms
since the Debian 5.0 ('lenny') release.
These packages are available in the
<em>non-free</em> section, so you have to configure your apt sources appropiately. If
you have the following in your <file>/etc/apt/sources.list</file>:
<example>
deb http://ftp.debian.org/debian etch main
</example>
you need to change it to:
<example>
deb http://ftp.debian.org/debian etch main contrib non-free
</example>
Once this is done and you have updated your package database. You can either
install the Java development kit:
<example>
apt-get install sun-java6-jdk
</example>
or the Java runtime environment:
<example>
apt-get install sun-java6-jre
</example>
<p>Similarly, you can install the Java 5 development kit:
<example>
apt-get install sun-java5-jdk
</example>
or the Java 5 runtime environment:
<example>
apt-get install sun-java5-jre
</example>
<p>Sun recommends you update the alternatives system to have Sun's tools as the
default:
<example>
update-java-alternatives -s java-6-sun
</example>
Or for java 5:
<example>
update-java-alternatives -s java-1.5.0-sun
</example>
<sect1 id="openjdk">Sun's OpenJDK
<p>Sun adopted in november 2006 the GPL license for almost all of the virtual
machine and GPL v2 + the <em>Classpath exception</em><footnote>This is similar
to GCC linking exception in that it allows non-GPL code to be linked with the
GPL code. This exception was developed by the <url
id="http://www.gnu.org/software/classpath/license.html" name="Classpath
project"></footnote>for the class libraries and those parts of the virtual
machine that expose public APIs.
<p>As a consequence, the free OpenJDK code is available in Debian since the
5.0 (lenny) release.</p>
<p>You can install the Java development kit:
<example>
apt-get install openjdk-6-jdk
</example>
or the Java runtime environment:
<example>
apt-get install openjdk-6-jre
</example>
<p>For more information see <url id="http://www.sun.com/software/opensource/java/faq.jsp" name="Free and Open Source Java">.
<sect1 id="ibm-jdk">IBM's Developer Kit for Linux
<P>
<sect2>Can Debian distribute IBM's jdk?
<p>No, as its license does not allow redistribution. Actually, older releases
(version 1.1) even restricted use of the jdk to specific distributions (and
Debian was not included in the list).
<p>You can still download it and use it in Debian yourself even Debian
is not in the list of tested (or supported) platforms, see
<url id="http://www.ibm.com/developerworks/java/jdk/linux/">.
<sect2>Is it possible to obtain a licence for Debian?
<p>It would still be non-free, because of item 8 in the <url
id="http://www.debian.org/social_contract#guidelines" name="Debian Free Software
Guidelines">: "License Must Not Be Specific to Debian".
<sect1>JRE
<p>
<sect2>Can Debian distribute JRE?
<p>
(Quoted from Gene McCulley <url
id="http://lists.debian.org/debian-java/1999/debian-java-199908/msg00021.html">)
I don't think we can or want to distribute the JRE with Debian.
The supplemental license terms of the JRE has a few very nasty clauses:
<example>
1. License to Distribute. You are granted a royalty-free right to
reproduce and distribute the Software provided that you: (i)distribute
the Software complete and unmodified, only as part of, and for the
sole purpose of running, your Java applet or application ("Program")
into which the Software is incorporated;
</example>
<p>We might get away with this one since we distribute it together with
Java applications bundled with Debian. But we also do want to allow people
to download only the jre package.
<example>
(ii) do not distribute additional software intended to replace any
component(s) of the Software;
</example>
<p>But we cannot agree to this one. We want to distribute Kaffe, Japhar,
Classpath, Gcj, Kopi, Fastjar, etc which are intended to replace the JRE
with a Free version. Even if we don't consider non-free part of Debian
(the JRE would not go into main :) I think we should not encourage software
that tries to prevent Free replacements.
<example>
[...] (v) may not create, or authorize your licensees to create additional
classes, interfaces, or subpackages that are contained in the "java" or
"sun" packages or similar as specified by Sun in any class file naming
convention;
</example>
<p>My example why this is a bad clause was not so good since someone pointed
out that you do not want to create something that is non standard. I do
agree that we want a standard implementation of the core classes, but I
also think that you should have the freedom to create non-standard classes.
(Or fix bugs or stupid mistakes in the standard classes.)
<example>
[...] and(vii) agree to indemnify, hold harmless, and defend Sun and its
licensors from and against any claims or lawsuits, including attorneys'
fees, that arise or result from the use or distribution of the Program.
</example>
<p>And I don't think that Debian (or SPI) can or wants to do that.
<p>So I am afraid that we also cannot distribute the Sun JRE.
This isn't that bad since it is non-free software, but it is annoying.
As I said before please help one of the (many) Free Java projects out there
if you want to see a Free JVM, Standard Classes, Compiler, etc. in Debian.
They are far from complete but they do work for most purposes
<sect1>GPL or LGPL?
<p>
Java uses dynamic linking at runtime. Using the reflection
API and class loading, the linking can be completely data
driven, specifying classes and methods by name. This moves
the legal issues of using GPL'ed Java code into the user's
hands, as a violation of the GPL can not be proven from the
executable itself. Unlike plugins, Java classes do not even
have to have a specific structure to be used in such ways.
By using native methods and selecting DLL's at runtime,
this problem might also affect native code.
</P>
<P>
Example: a GPL'ed Java dependency checker using the
reflection API. Java's runtime linkage, in particular the
reflection API, blurrs the lines between code and data
even more than e.g. native plugins.
</P>
<P>
If you want to write Java code that can be used without
the user having to worry about licensing issues, consider
using the Lesser GPL (LPGL). If you want to avoid seeing
your classes and packages being used by non-free software,
consider using the GPL license.
</p>
<sect id="sect:dfsg-compliant-gui">How can I make a DFSG compliant Java GUI program?
<p>Many Java programs use the Swing library for GUI development. For this there
is the <package>libswing-java</package>. Most programs will compile against this library,
but that does not garantee it to work. Not always are all classes implemented or
implemented well.
<p>An alternative to the Swing library is the Standard Widget Toolkit (SWT,
<package>libswt-java</package>) which is based on the GTK+ library.
<p>A third alternative is the use the GUI functionality from either
KDE or Gnome. For KDE, the kdebindings tar.gz does the job (is there a
deb package too?). For Gnome there is the
<package>libgnome0-java</package>.
<sect>Making Debian packages for Java programs.
<p>
<sect1>Can the package go into main?
<p>Yes, <em>but only if</em> it can be build and run with Java programs/tools
in main, and if it has a Debian compliant open source license.
If it needs programs from contrib or non-free, then is <em>must</em>
go into contrib or non-free, depending on the license of the program itself.
<p>More specifically, if the program can be build and run with
<package>free-java-sdk</package>, then it only depends on Debian packages
from main. The <package>free-java-sdk</package> description states:
"Just install this package, set JAVA_HOME to /usr/lib/fjsdk and try to rebuild
your Java packages. If it works - a package from contrib section can be moved
to main."
<sect1>What virtual packages could I use?
<p>
<list>
<item><package>java-common</package>. It is the Mother Of All Java
Packages, in the proposed policy. It contains the text of the Policy
(Docbook), as well as utilities
scripts (for instance to build a CLASSPATH from a list of jars
(submissions welcome).
<item><package>java-virtual-machine</package>
<item><package>java-compiler</package>
<item><package>java-compiler-dummy</package>.It is a small tool useful for the transition to the new Policy. Until all
compilers comply with the Policy, java-compiler-dummy provides the following
services:
<list>
<item>Provides: java-compiler so upper packages are happy,
<item>set CLASSPATH before calling the real compiler.
</list>
<item><package>java-virtual-machine-dummy</package>.It is a small tool
useful for the transition to the new Policy. Until all virtual machines
comply with the Policy, java-virtual-machine-dummy provides the following
services:
<list>
<item>Provides: java-virtual-machine so upper packages are happy,
<item>set CLASSPATH before calling the real VM.
</list>
</list>
<sect1>Is there a good example Debian package?
<p>There are many Debian packages of both Java applications and libraries.
These may serve as an good starting point, as it can serve as an example
for making a new Debian package.
<p>A good start would be to check out the pkg-java project on
Alioth: <url id="http://pkg-java.alioth.debian.org/">.
<p>Note that there are many ways to make a Debian package, making use
of Ant or Makefiles does not really matter.
But, some tips for good practice are given on the pkg-java page:
<url id="http://pkg-java.alioth.debian.org/developers.html#rules"> and
<url id="http://pkg-java.alioth.debian.org/building.html">.
<sect1>What tools are available to make maintaining a Java packages easier?
<p>At this moment, there is dh_javadoc, which is a tool
in the <package>gjdoc</package> package in Debian unstable. And, there
are tools in <package>cdbs</package> which can help build packages with
<package>ant</package>.
<chapt>Java Compilers
<p>
<sect>What Java compilers are available in Debian?
<p>
<list>
<item>The deprecated <package>jikes</package> in <em>Lenny</em>.
<item><package>gcj</package>. Compiles Java source to native code,
also source to bytecode, or bytecode to native code.
</list>
<chapt>Java Virtual Machines (JVM)
<p>
<sect>What jvms work in Debian?
<p>Currently Sun's and Ibm's jvms work in Debian. Another solution is to use
gcj and to compile to native code, thus solving the VM problem.)
<P>All of them can be unpacked in /usr/local with links made in
/usr/local/bin. This will work in any Debian setting and version, the
only issue being is wether or not the version is glibc based or
libc5-based regarding (older versions of Debian do not have glibc
support since it was included in Debian 2.1 codename <em/slink/)
<sect>What free JVMs are available in Debian?
<p>The following lists JVMs available in the latest Debian release (4.0,
'etch'):
<list>
<item><package>kaffe</package>
<item><package>sablevm</package>.
<item><package>gij-4.1</package>
</list>
<p>If you want to look for available JVMs in a different release, this list can
be reproduced with the command:
<example>
grep-available -F Provides -sPackage java-virtual-machine
</example>.
<sect>What API do these JVMs provide?
<p>Note that providing an API does not mean that everything is
implemented, and certainly not implemented correctly. But even Sun's
SDK, each out of four confirmed bugs don't get fixed, so don't
disregard free implementation on buggyness or limited implementation
alone.
<p>Several APIs are compared for GNU Classpath, GNU gcj, Kaffe and Wonka with
<url name="japitools" id="http://rainbow.netreach.net/~sballard/japi/">.
<sect>Are there known problems?
<p>Yes, there are. Some of these are reported as Debian bugs. You can
look up the bugs for a specific Debian package at the <url
id="http://www.debian.org/Bugs/" name="Debian Bug Track System">. As
a quick link, here are some packages:
<list>
<item><url id="http://bugs.debian.org/kaffe" name="kaffe">
<item><url id="http://bugs.debian.org/gcj" name="gcj">
<item><url id="http://bugs.debian.org/sablevm" name="sablevm">
</list>
<p>As common within the Debian project, the developers would
appreciate good bug reports on found problems. These include the good
description of the problem, the command that gives the problem, the
errors given when running the command, and any other information that
might be relevant. A good tool to report bugs is
<package>reportbug</package>.
<sect>Do I need a JVM to run a Java program in Debian?
<p>
No, you can try to run the applications without a jvm by compiling
the source code to native code is.
<sect1>How do I compile to native code?
<p>You might be able to use <prgn>gcj</prgn> or <prgn>jikes</prgn> (both free
programs), to compile the program.
And use <prgn>gcj</prgn> to convert bytecode to native code. The entire
software chain is free.
<sect1>Are there any successes using this approach?
<p>Most certainly, read in <url
id="http://lists.debian.org/debian-java/1999/debian-java-199911/msg00044.html">
how this was done for the XML parser <prgn>xp</prgn>.
<example>
ezili:~/infosystems/XML/Java> gcj --main=UnTag UnTag.java UnTagHandler.java
/usr/share/java/repository/org/xml/sax/helpers/*.class
/usr/share/java/repository/org/xml/sax/*.class /usr/share/java/repository/com/j
clark/xml/sax/*.class /usr/share/java/repository/com/jclark/xml/parse/*.class
/usr/share/java/repository/com/jclark/xml/tok/*.class
/usr/share/java/repository/com/jclark/util/*.class
/usr/share/java/repository/com/jclark/xml/parse/base/*.class
</example>
<sect1>Are there any problems with this approach?
<p>
Yes there are also some problems.
<p><prgn>gcj</prgn> does not fully support JNI. Tom Tromey is
responsible for the JNI implementation. As of april 2000
it is missing one feature (you can't currently compile a
.class file that uses JNI functions to implement its native methods),
but Tom is working on this and hope to have it completed "soon".
<p>Lack of JNI affects use of Classpath (e.g. as an alternative to libgcj)
as well as small, standalone apps that replace AWT with some really simple
GUI (like using curses, e.g. for small installers). It also affects projects
which have native code for performance reasons. At the moment, gcj basically
forces a CNI port. The only alternative we are aware of is TowerJ, which is
good for commercial projects, but does not offer anything to free software.
<sect1>Does these work for architectures different than i386?
<p>Possibly not, since libgcj does not build on sparc and no one has
tried this for arm.
<chapt id="browser-java">Java Plugins for Browsers
<p>The following section describes how you can use Java in
web browsers in order to be able to run <tt>applets</tt> published
in web servers.
<sect>Can I use any JVM as a Java Plugin?
<p>That is a tricky question. My answer would be: "No, but it doesn't
hurt trying" (and don't forget to forward us your findings so we
can update this document)
<sect id="konqueror-java">Can I use Java in Konqueror?
<p>Yes, in Konqueror 3.1.1, you Settings->Configure Konqueror. The opened
Control Module has a Java&JavaScript section where you can enter the location of
your JVM. The configuration should look like this:
<list>
<item>Selected "Enable Java globally"
<item>Selected "Show Java console"
<item>"Path to Java executable" has /usr/bin/java
</list>
<p>As it says <file>/usr/bin/java</file> it relies on the <prgn>update-alternatives</prgn>
mechanism to point to a JVM that can serve as a plugin.
If you have Sun's J2RE installed, "Path to Java" might also say something like
<file>/usr/local/lib/j2sdk1.4.2/jre/bin/java</file>
<sect id="netscape-java">Can I use Java in Netscape 6.x/7.x?
<p>Yes. Make a symbolic link in the <file>/path/to/netscape/plugins</file>
directory to the Java Plugin as can be found in Sun's J2RE:
<example>
/usr/local/netscape/plugins $ ls -la
total 960
drwxr-sr-x 2 root staff 4096 Apr 30 09:46 .
drwxr-sr-x 9 root staff 4096 Apr 8 20:26 ..
-rw-r--r-- 1 root staff 2363 Feb 8 07:47 ShockwaveFlash.class
-rw-r--r-- 1 root staff 946108 Feb 8 07:47 libflashplayer.so
lrwxrwxrwx 1 root staff 64 Apr 30 09:46 libjavaplugin_oji.so -> /usr/local/lib/j2sdk1.4.2/jre/plugin/i386/ns610-gcc32/libjavaplugin_oji.so
-rwxr-xr-x 1 root staff 19396 Feb 8 07:47 libnullplugin.so
</example>
<sect>Can I use Java in Mozilla?
<p>Yes, the mechanism is identical to that of Netscape. However, the plugin
directory in this case is <file>/usr/lib/mozilla/plugins</file>. There is
additional information on how to install Java in Mozilla at the
<url id="http://plugindoc.mozdev.org/faqs/java.html" name="Java FAQ at Mozilla">
<P>There might be some issues depending on your version. Mozilla 1.4
and later (as well as Mozilla Firebox) is compiled with gcc 3.x and
needs a compatible version of the plugin, as provided by JRE 1.4.2 or
later. If you find issues you will need to debug yourself. A common
problem is that the library might not be binary compatible if it was
compiled with a different <prgn>gcc</prgn> version. Some gory details
on how to debug this are described below (contributed by Tim Freeman
and included in the <url
id="http://www.linuks.mine.nu/debian-faq-wiki/MiscellaneousPage"
name="#debian faq wiki">)
<p>The first problem is that in version 1.6-5 of the
<package>mozilla-browser</package> package, at least,
<file>/usr/bin/mozilla</file> is a shell script that redirects errors
to <file>/dev/null</file>. This is described in <url
id="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=178721" name="bug
178271">
<p>To deal with this, make a copy of <file>/usr/bin/mozilla</file> and
edit out the redirects of file descriptor 2 to /dev/null and run the
copy. You may see something like this on Mozilla's standard error
when it starts:
<example>
LoadPlugin: failed to initialize shared library /usr/lib/j2se/1.3/jre/plugin/i386/mozilla/javaplugin_oji.so [/usr/lib/j2se/1.3/jre/plugin/i386/mozilla/javaplugin_oji.so: undefined symbol: __vt_17nsGetServiceByCID]
</example>
<P>This symptom indicates that your Java was compiled with an old
version of GCC, but your Mozilla was compiled with a newer version
(post gcc 3.0.3), and the two are binary incompatible. This is the
case for version 1.3.1.02b-2 of the <package>j2re1.3</package> package
from <url id="ftp://ftp.tux.org">, at least.
<P>If you're confronted with this symptom, the fix is to get a Java
runtime that was compiled with a more recent gcc. There are several
available; one is <url
id="ftp://ftp.tux.org/pub/java/JDK-1.4.2/i386/01/j2re-1.4.2-01-linux-i586.bin">.
Install that and change the libjavaplugin_oji.so link to point into
the newly installed Java runtime. <P>If you wish to confirm the
diagnosis before attempting the above treatment, you can do it as
follows. Confirm that your Java was compiled with the old gcc by
giving the command:
<example>
c++filt -s gnu __vt_17nsGetServiceByCID
</example>
<P>and getting the result:
<example>
nsGetServiceByCID virtual table
</example>
<p>To confirm that your mozilla was compiled with the new gcc, you can
find its version of the symbol by giving the command:
<example>
objdump -R /usr/lib/libxpcom.so | grep nsGetServiceByCID
</example>
<p>and you'll see a line like:
<example>
000ec114 R_386_GLOB_DAT _ZTV17nsGetServiceByCID
</example>
<p>Then you demangle that with the command:
<example>
c++filt -s gnu-v3 _ZTV17nsGetServiceByCID
</example>
<P>and get this eminently reasonable output:
<example>
vtable for nsGetServiceByCID
</example>
<P>The important thing is that the two calls to c++filt both succeeded
but they were told to use different demangling rules, "gnu" for the
first and "gnu-v3" for the second. If this all checks out, then you
should fetch a newer Java runtime as described above.
<chapt>Java Servlets
<p>
<sect>How can I make Java servlets work?
<p>You can use:
<list>
<item><package>gnujsp</package>
<item>Apache <package>jserv</package>. <url id="http://java.apache.org/jserv/index.html">.
<item>Apache <package>tomcat</package> from <url id="http://jakarta.apache.org/tomcat/">.
</list>
<p>Also others not yet packaged for Debian but which migh be soon included are:
<list>
<item>jigsaw from <url id="http://www.w3.org/Jigsaw/">.
<item>Jetty <url id="http://mortbay.com/software/Jetty.html"> (tested
successfully on a potato machine)
</list>
<sect>Do I need non-free Java in order to run servlets?
<P>Not known. Possibly not, need to explain.
<chapt>Java Policy
<p>
<sect>Is there a Java policy for Debian?
<p>
It is still in the works. The current policy addresses <em>some</em>
of the problems. It has not been officially released. You can find
it at <url id="http://www.debian.org/doc/packaging-manuals/java-policy/">.
The Java Policy can also be found in the <package>java-common</package>
package. You might want to also take a look at the
<url id="http://wiki.debian.org/DebianJavaPackaging"
name="Common Java Packaging"> entry in the Debian wiki.
<sect>Are there holes in the Java Policy?
<p>Yes, some until under discussion. Please check out the
<url id="http://bugs.debian.org/java-common" name="bugs against
the java-common package">. Thus it is <em>very</em> inconvenient to
use several compilers of virtual machines since there is not one
CLASSPATH setting for all of them.
<chapt>Other Java alternatives for Debian
<p>If the Java packages provided in Debian are not sufficient for your
needs you might need to take a look at other alternatives. Please understand
that these alternatives are not supported by the Debian project directly,
you might get help, however, from the debian-java mailing list if you
encounter issues with them.
<P>Some of the alternatives presented use Debian packages which is
convenient, since the user/administrator does not need to care on installation
issues. However, mixing packages that come from a source which is not
the Debian project might cause conflicts with your installation some times.
Of course, Debian tries to integrate as many free software efforts as
possible, so some of the alternatives described below might (if license
permits) be included in Debian in the near future.
<sect>Java programs not yet available on Debian
<p>
The following are programs that have not yet been packaged for Debian
nor is there an installer. There are quite a lot Java programs out
there and this list is not an exhaustive list, it only includes
programs that <em>might</em> be packaged for Debian or those that
someone is working on an installer for:
<list>
<item>BlueJ. A development environment for Java with editor, compiler,
virtual machine and debugger. See <url
id="http://bluej.monash.edu.au/">
<item>Jacob (Java Commando Base): project maintainer and visualiser
for Java in Emacs. See <url
id="http://home.pages.de/~kclee/clemens/jacob">.
<item>Emacs in Java. See <url id="http://jemacs.sourceforge.net/">.
<item>Netbeans developer, now called <em>Forte</em>. Based on the
Javabeans architecture. See <url id="http://www.netbeans.com">.Sun
recently announced they would open-source it. See <url
id="http://www.sun.com/forte/tools4dotcom/opensource.html">.
<item>AnyJ. Graphic environment to develop applications, applets and
servlets. More info in <url id="http://www.netcomputing.de">.
<item>Free Builder. A Java IDE written in Java and distributed under
the GPL <url id="http://www.freebuilder.org">.
</list>
</book>
|