Debian GNU/Linux Java FAQ. Javier Fernández-Sanguino Peña jfs@debian.org $Revision: 1.57 $ Sunday, 4th November 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 . 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. Introduction

Introduction to this FAQ

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.

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.

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.

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.

This document does not address issues with other Linux distributions, or with non-Debian-specific problems. See the for information on these. More specifically you might want to check out the written by Stephen M Wynne (last updated january 2000 as of this writing). Another useful source of general information might be the maintained by Nathan Meyers. Location of this FAQ

This FAQ is published under the Debian Documentation Project at . The java-common (available at ) 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. Sending bugs on this FAQ

Please note that this FAQ is slightly out of date and is seeking an active maintainer. If you are willing to maintain it and are knowledgeable about Java in Debian, please contact the current maintainer. In any case, fixes to information that is not up to date are welcome (patches against the latest are even better).

In any case, if you want to send bugs on this FAQ please send them to the current maintainer. However, make sure you are reading the latest (english) version available at Note that translations, if available, might also be slightly out of date from the original, english, version. Check out the english version first if you are reading a translation before sending a bug. Complementary information

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 at the Debian's wiki.

Since Ubuntu is based on Debian, some users might find it helpful to check the tips on on Ubuntu's wiki. Uncovered issues

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: Information on how to use update-alternatives to handle Java and how /etc/jvm and /etc/java. 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. Specific information targeted for non-i386 users (PowerPC users and AMD64 users), some can be found in Ubuntu's wiki. Introduction to Java What is Java?

Java is a strongly-typed platform-independent object-oriented programming language often associated with the World Wide Web. Java was developed by 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.

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.

The multithreading support can happen either in kernel threads or userland threads, depending on the implementation of the Java virtual machine used.

Of course, Java is also the name of a popular island of Indonesia: check out the facts at the Why would I be interested in Java?

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. What is a JIT?

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. Where can I read more about Java?

Of course, 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: Sun's pages. Blackdown's . GNU's Enterprise in a Nutshell by Gary Meyer, at . 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 . The , the following articles might be worth reading: Issue 105 Issue 94 Issue 66 and . The , the following articles might be useful: Issue 87 Issue 69 Issue 48 Issue 45 Issue 33 Issue 32 Issue 25 , a free multilingual journal: March 2003: January 1999: July 1998: The Java-CGI HOWTO from David H. Silber at explains how to set up your server to run Java CGIs. Maybe it is worth looking at servlets. Java Programming on Linux, by Nathan Meyers, website at , which is a book devoted to the topic of using Java on Linux (there's no online version of it, though) Other sites regarding Java would be: The Java Lobby . Brewing Java: a tutorial at . 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 . Check also for pointers to the free Java platforms available, which might or might not be listed in GNU's webpages devoted to Java. Where can I ask questions about Java on Debian?

The appropriate place to ask such questions is debian-java at lists.debian.org. You can subscribe at the page. Status of Java in Debian GNU/Linux 3.0 (Woody) Where is Debian Java going?

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 Notably Blackdown's port to Linux of Sun's Java Developer's Toolkit (SDK) or Java's Runtime Environment (JRE). Which you should retrieve from Blackdown, see . are not available in the standard Debian distribution for licensing reasons, not for any technical motivation (see ).

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.

If you are really interested, read the following: and . This section is a summary of the information therein. (Note: this information might not be fully updated at this point in time, it was written around 1999) Is there a Java1 compiler (.java to .class)?

There is the Kopi Java Compiler written in Java. And the super fast Jikes written in C++.

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. Is there a Java1 JVM or JIT?

Kaffe 1.0.5 is largely feature complete and now includes support for RMI. It is not clear as to whether Kaffe's serialization is "binary compatible" with Sun's implementation in all cases so there may be interoperation issues in some casses. Kaffe comes with a big class library.

libgcj (the run-time library for gcj) now includes an interpreter and ClassLoader.

tya, a JIT compiler, is also available. Is there a Java1 native compiler?

GCC, the Gnu Compiler Collection comes with GCJ, the Gnu Compiler for Java Java2 native compiler

It is unclear whether native compiler refers to the adaptive JIT capabilities in Java2 or to a compiler that understands Java2 semantics. In either case, Kaffe's JIT strategy is not adaptive but performs correctly, and improving, it is believed IBM's Jikes compiler understands Java2 concepts such as weak references. Does Debian have Java2 foundation libraries?

Many of these components have been cloned under a Free Software license. Kaffe provides many of these routines, including an up-to-date RMI implementation. There are, however, definitely shortcomings. Swing, as far as we know, has not been cloned. Is there a Java Debugger (jdb equivalent)?

jswat

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.)

See on how to debug gcj-compiled Java programs. What free edit-interactive/graphical debugging tools are available on Debian?

jde, ddd, more?

One of the some nice features of jde are autoindention and syntax highlighting, but it also supports debugging and compilation. Known problems

My version of jdb (jdb version 98/01/06) terminates after a program finishes execution, and I have to reset every breakpoint if I want to run through the program again. This makes using jdb extremely frustrating. Jdb also can't (easily) print the values in an array which is more than three elements long. Ddd lets me work around both of these annoyances.

ddd 3.1 and earlier would "hang" when receiving certain prompts with wierd thread names from jdb. This made it very hard to use ddd with jdb. This has been fixed in ddd 3.2. It doesn't look like ddd 3.2 has been packaged yet. I suspect the current packaged version of ddd won't work well with jdb. Is there an Appletviewer tool?

There are some alternatives for an appletviewer tool: Blackdown's appletviewer (in jdk1.1). Kaffe's appletviewer. Ibm's appletviewer (in ibm-jdk). Is there a Jar tool?

FastJar which is indeed very fast. Kaffe also has a jar tool. Is there a Javadoc tool?

doc++ can work with C++ and Java. Additionally, there are the gjdoc and gjdoc-native packages. Does Debian do Enterprise Java Beans (EJB)?

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). What is JAIN?

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. What is Jini?

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. Is there a full list of packages?

Below is a list given on packages that can be found in Debian 3.0 (aka Woody). The list does not display which of these packages can be found in main, and which is contrib or non-free. Runtime environments/Virtual Machines jdk1.1 (Sun's JDK 1.1.8) IBM 's JDK 1.1.8 (installer package) kaffe kissme sablevm Tools Compilers jikes (also jikes-1.14, jikes-gij, jikes-kaffe) jdk1.1 gcj tya (JIT compiler) Debuggers/Testing jswat junit IDE/Editors jedit jde Build tools ant jmk mmake Other fastjar jad (decompiler) Ant Libraries lib-dom-java lib-gnu.getopt-java lib-gnu.regexp-java lib-saxon-java libavalon-excalibur-java libavalon-framework-java libbcel-java libbsf-java libcrimson-java libcommons-beanutils-java libcommons-collections-java libcommons-digester-java libjdom-java libjunitperf-java libldap-java liblog4j liblogkit-java libnbio-java liboro-java libpgjava libreadline-java libregexp-java libservlet2.3-java libservlet2.2-java libsoap-java libtomcat4-java libxalan-java libxalan2-java libxerces-java libxerces2-java libxt-java Status of Java in Debian GNU/Linux 3.1 (Sarge) Are there many changes?

Yes, quite some. There have been very interesting developments in Debian Java lately. Slowly, there seem be developed a set of Debian tools to deal with maintaining Debian package of Java applications and libraries. At this moment, there only seems to be dh_javadoc, which is a tool in the gjdoc package. However, people spoke about other tools on the debian-java mailing list in 2003.

In addition to this, ant has found its way into main, paving to way for other packages to enter main.

And the eclipse seems to get rather stable. Early August 2003, the gcj team even was able to compile the IDE to native code, using only minor modifications.

It is quite useful to first browse the section on Java in Debian GNU/Linux Woody (since those in woody are also in later releases, see ), but there are somes changes. Instead of listing all the packages again, this section will list only changes: eclipse An extensive IDE sablevm A free Virtual Machine free-java-sdk A free Java SDK (compiled from DSFG compliant Java tools) libgnome0-java Java bindings to Gnome GUI library gjdoc A Javadoc 1.3 replacement (90% of Doclet API implemented) kaffe Release 1.1.3 can run much more software than 1.0.5 in woody ant Version 1.6 is in main

The following packages are no longer in testing/unstable: libswing-java Which is mentioned here: . Status of Java in Debian GNU/Linux 4.0 (Etch)

The Etch release was the first one to provide Sun's JDK environment without the need to download it from third-party repositories (see ).

As part of the effort to move Java packages to main, 36 new Java packages were moved to main after being built with free Java development tools. Notably, ant (a Java-based build tool), libstruts1.2-java (a MVC framework), tomcat5 (a Java servlet engine) and eclipse (a developer's environment platform) have been moved to main. For the full list see the . Which Java package are currently in main?

At the time of writing, 209 Java packages were found in main, of which 119 were Java libraries. To see the list of packages in main (i.e., not contrib and non-free), try: grep-available -F Depends -sSection,Package java | paste -sd " \n" | \ grep -v contrib | grep -v non-free | sort

There are additional packages in the contrib section which can be found with a command similar as the one above.

The website also maintains a list (probably more up to date) of java packages. What keeps Java packages out of main?

An overview of packages that are still not in main is found at the Debian Wiki site: .

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. A number of packages have been moved to main and new releases of GNU Classpath, SableVM, and Kaffe promise further steps ahead. Two of the major issues currently being looked at are making gjdoc a proper javadoc replacement and building ant with Free Software only. People wanting to help can start by inspecting packages labeled as unknown on the What can I expect in future releases?

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.

Debian has a roadmap to publish all of Sun's opensource Java technologies as described in the . The current version of the roadmap is at the . Status of Java in Debian GNU/Linux 5.0 (Lenny)

The Lenny release was the first one to provide Sun's OpenJDK environment (see ).

A more up-to-date status of Java in the current Debian release is available at the . Java Development

What full-fledged Java development platforms are available in Debian?

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: Sun's jdk 1.4 (port made by Blackdown, see or go to ) kaffe. Sun's Java 5 jdk, available in the Debian 4.0 etch release in the non-free section. Sun's Java 6 jdk, available in Debian lenny (unreleased, currently testing) and Debian sid, also as packages in the non-free. Sun's OpenJDK 6 jdk, available since the Debian 5.0 lenny release in the main section.

Previous release of Debian included an installer package for IBM's Java Development Kit, but that is not longer available.

Since the Debian 3.1 'sarge' release, Debian provides the free-java-sdk package which makes up a free Java Software Development Kit (SDK). All software it depends on are DFSG compliant. What free platforms are there and how can I contribute?

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: kaffe: . gcj and libgcj: jikes: . A fast compiler written in C++ (check also ). (The new license seems to be finally really free) kopi: .Yet Another Free Java Compiler, this time written in Java, and GPL. Included in Kaffe since release 1.0.5. FastJar , as a jar tool. (this link seems to be broken, anyone?) Classpath or . 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. Most of the RMI classes are implemented by NinjaRMI Autoconf macros helps easy recompilation of Java programs. Mauve is a free suite to test if these tools are 'compliant'.

Most free Java development is grouped under the . There is a list on free Java at . Questions on platforms and license concerns Java 5 and 6

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 non-free section, so you have to configure your apt sources appropiately. If you have the following in your /etc/apt/sources.list: deb http://ftp.debian.org/debian etch main you need to change it to: deb http://ftp.debian.org/debian etch main contrib non-free Once this is done and you have updated your package database. You can either install the Java development kit: apt-get install sun-java6-jdk or the Java runtime environment: apt-get install sun-java6-jre

If you are using the Debian 4.0 'etch' release you will find Java 5 instead. Similarly, you can install the Java development kit: apt-get install sun-java5-jdk or the Java runtime environment: apt-get install sun-java5-jre

Sun recommends you update the alternatives system to have Sun's tools as the default: update-java-alternatives -s java-6-sun Or for java 5: update-java-alternatives -s java-1.5.0-sun Sun's OpenJDK

Sun adopted in november 2006 the GPL library for almost all of the virtual machine and GPL v2 + the Classpath exceptionThis 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 for the class libraries and those parts of the virtual machine that expose public APIs.

As a consequence, the free OpenJDK code is available in Debian since the 5.0 (lenny) release.

You can install the Java development kit: apt-get install openjdk-6-jdk or the Java runtime environment: apt-get install openjdk-6-jre

For more information see . Java 2 SE (aka JDK1.2)

Why is Sun's Java 2 SE (aka jdk 1.2) not available?

Due to license problems. Clause 2 of the (check also the ) that comes with is says: Software is confidential and copyrighted. Title to Software and all associated intellectual property rights is retained by Sun and/or its licensors. Except as specifically authorized in any Supplemental License Terms, you may not make copies of Software, other than a single copy of Software for archival purposes. What are the problems with Suns' new license?

Sun has moved to a new license the Sun Community License, like the GPL it is a viral license, but making all it touches subject to Sun licensing fee. The SCSL even goes so far as to define any implementation of a Sun specification as a "Modified Work". Basically, this means that if you implement any part of the new 1.2 API or Jini API, even from scratch, Sun will "own" your implementation and you will have to pay them for the right to use it. 13. "Modification(s)" means (i) any change to Covered Code; (ii) any new file or other representation of computer program statements that contains any portion of Covered Code; and/or (iii) any new Source Code implementing any portion of the Specifications. What is the SCSL?

The SCSL is the "Sun Community Software License" that can be found . It is not compatible with Free Software for several reasons, and agreeing to this license (e.g. by downloading source covered by the SCSL) will make it impossible for you to contribute to free software clean-room implementations. According to Sun, this includes using documentation and API specifications available only under SCSL.

To quote one open source developer, the SCSL is "about as free as the former Soviet Union".

However, if you have never agreed to the SCSL, then it is still permissible, barring any patents that Sun has for the technology, for you to create your own clean room version of the 1.2 API. It is important that you never agree to the license, even for the documentation. For example, if you buy a printed book which describes the API, there is a long legal history (in the US at least), that prohibits attaching these kinds of contracts to books. Can I use jdk1.2 while working with the free Java implementations?

Clause 1 of the Supplemental License Terms says: [You] 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;

Which seems to prevent one from making his own implementation of the standard Java classes using the JDK.

However, it is unclear whether or not the word `additional' includes reimplementations of existing classes, or whether it applies only to classes with new names. Why is (some) free software not implementing Java2?

Sun has made public statements in connection with their legal strategy in the Sun-Microsoft lawsuit that indicate that the company considers the published specifications of Java2 to be intellectual property that can not legally be used by persons involved in efforts to create Java2 clean-room implementations. For this reason, some open source projects have decided to not implement Java2 any time soon. One example is Kaffe. Some projects (like the Classpath project) have decided to challenge Sun's legal position and are going ahead with Java2. IBM's Developer Kit for Linux

Can Debian distribute IBM's jdk?

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).

You can still download it and use it in Debian yourself even Debian is not in the list of tested (or supported) platforms, see . Is it possible to obtain a licence for Debian?

It would still be non-free, because of item 8 in the : "License Must Not Be Specific to Debian". JRE

Can Debian distribute JRE?

(Quoted from Gene McCulley ) 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: 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;

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. (ii) do not distribute additional software intended to replace any component(s) of the Software;

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. [...] (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;

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.) [...] 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.

And I don't think that Debian (or SPI) can or wants to do that.

So I am afraid that we also cannot distribute the Sun or Blackdown 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 GPL or LGPL?

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.

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.

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.

How can I make a DFSG compliant Java GUI program?

Many Java programs use the Swing library for GUI development. For this there is the libswing-java. Most programs will compile against this library, but that does not garantee it to work. Not always are all classes implemented or implemented well.

An alternative to the Swing library is the Standard Widget Toolkit (SWT, libswt-java) which is based on the GTK+ library.

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 libgnome0-java. Do swing-based programs work in Debian?

Swing does work and can be installed, please note that 1.2 and 1.3 jvms include swing, otherwise you need to download it for your particular jvm. See later on how to make it work. Making Debian packages for Java progams.

Can the package go into main?

Yes, but only if 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 must go into contrib or non-free, depending on the license of the program itself.

More specifically, if the program can be build and run with free-java-sdk, then it only depends on Debian packages from main. The free-java-sdk 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." What virtual packages could I use?

java-common. 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). java-virtual-machine java-compiler java-compiler-dummy.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: Provides: java-compiler so upper packages are happy, set CLASSPATH before calling the real compiler. java-virtual-machine-dummy.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: Provides: java-virtual-machine so upper packages are happy, set CLASSPATH before calling the real VM. Is there a good example Debian package?

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.

A good start would be to check out the pkg-java project on Alioth: .

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: and . What tools are available to make maintaining a Java packages easier?

At this moment, there is dh_javadoc, which is a tool in the gjdoc package in Debian unstable. And, there are tools in cdbs which can help build packages with ant. Java Compilers

What Java compilers are available in Debian?

jikes. Reported to work fine with all JDKs (1.1 to 1.3), it is suggested you use -E when compiling under Emacs. gcj. Compiles Java source to native code, also source to bytecode, or bytecode to native code. kjc is included in kaffe 1.0.5 and above. There is no separate package.

The following Java compilers where available in the past, but are no longer available: guavac. The compiler of Effective Edge Technologies. This compiler is orphaned upstream; for real work use gcj or jikes. tya. A just-in-time compiler, used to compile Java to byte code. bock. Java to C compiler. gck. Java Virtual Machines (JVM)

What jvms work in Debian?

Currently Blackdown's, Sun's and Ibm's jvms work in Debian. (But, for simple programs such as the ones used for teaching, the free kaffe VM may be enough. Another solution is to use gcj and to compile to native code, thus solving the VM problem.)

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 What free JVMs are available in Debian?

The following lists JVMs available in the latest Debian release (4.0, 'etch'): kaffe sablevm. gij-4.1

If you want to look for available JVMs in a different release, this list can be reproduced with the command: grep-available -F Provides -sPackage java-virtual-machine . What API do these JVMs provide?

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.

Several APIs are compared for GNU Classpath, GNU gcj, Kaffe and Wonka with . Are there known problems?

Yes, there are. Some of these are reported as Debian bugs. You can look up the bugs for a specific Debian package at the . As a quick link, here are some packages:

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 reportbug. Do I need a JVM to run a Java program in Debian?

No, you can try to run the applications without a jvm by compiling the source code to native code is. How do I compile to native code?

You might be able to use gcj or jikes (both free programs), to compile the program. And use gcj to convert bytecode to native code. The entire software chain is free. Are there any successes using this approach?

Most certainly, read in how this was done for the XML parser xp. 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 Are there any problems with this approach?

Yes there are also some problems.

gcj 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".

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. Does these work for architectures different than i386?

Possibly not, since libgcj does not build on sparc and no one has tried this for arm. Java Plugins for Browsers

The following section describes how you can use Java in web browsers in order to be able to run applets published in web servers. Can I use any JVM as a Java Plugin?

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) Can I use Java in Konqueror?

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: Selected "Enable Java globally" Selected "Show Java console" "Path to Java executable" has /usr/bin/java

As it says /usr/bin/java it relies on the update-alternatives 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 /usr/local/lib/j2sdk1.4.2/jre/bin/java Can I use Java in Netscape 6.x/7.x?

Yes. Make a symbolic link in the /path/to/netscape/plugins directory to the Java Plugin as can be found in Sun's J2RE: /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

If you have Blackdown's J2RE installed the link has to be made to /usr/lib/j2se/1.4/jre/plugin/i386/mozilla/javaplugin_oji.so. Other possible locations include /usr/java/j2re1.4.2_04/plugin/i386/ns610-gcc32/libjavaplugin_oji.so, you will need to locate this plugin depending on your installation. Can I use Java in Mozilla?

Yes, the mechanism is identical to that of Netscape. However, the plugin directory in this case is /usr/lib/mozilla/plugins. There is additional information on how to install Java in Mozilla at the

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 gcc version. Some gory details on how to debug this are described below (contributed by Tim Freeman and included in the )

The first problem is that in version 1.6-5 of the mozilla-browser package, at least, /usr/bin/mozilla is a shell script that redirects errors to /dev/null. This is described in

To deal with this, make a copy of /usr/bin/mozilla 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: 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]

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 j2re1.3 package from , at least.

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 . Install that and change the libjavaplugin_oji.so link to point into the newly installed Java runtime.

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: c++filt -s gnu __vt_17nsGetServiceByCID

and getting the result: nsGetServiceByCID virtual table

To confirm that your mozilla was compiled with the new gcc, you can find its version of the symbol by giving the command: objdump -R /usr/lib/libxpcom.so | grep nsGetServiceByCID

and you'll see a line like: 000ec114 R_386_GLOB_DAT _ZTV17nsGetServiceByCID

Then you demangle that with the command: c++filt -s gnu-v3 _ZTV17nsGetServiceByCID

and get this eminently reasonable output: vtable for nsGetServiceByCID

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. Java Servlets

How can I make Java servlets work?

You can use: gnujsp Apache jserv. . Apache tomcat from .

Also others not yet packaged for Debian but which migh be soon included are: jigsaw from . Jetty (tested successfully on a potato machine) Do servlets work with kaffe?

The servlet.jar in Kaffe will not work. It is only a shell. There is another LGPL implementation that was written by Paul and Mark Wielaard. It is available at these will have (have been?) added Apache JServ package so the user doesn't have to download Sun's classes any longer. Do I need non-free Java in order to run servlets?

Not known. Possibly not, need to explain. Java Policy

Is there a Java policy for Debian?

It is still in the works. The current policy addresses some of the problems. It has not been officially released. You can find it at . The Java Policy can also be found in the java-common package. You might want to also take a look at the entry in the Debian wiki. Are there holes in the Java Policy?

Yes, some until under discussion. Please check out the . Thus it is very inconvenient to use several compilers of virtual machines since there is not one CLASSPATH setting for all of them. Other Java alternatives for Debian

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.

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. How can I get Debian packages from Blackdown?

If the releases provided aren't recent enough for you, you can of course install the files from the Blackdown mirrors. You can either use the Debian packages provided by Blackdown or download their tar files.

(contributed by Federico Mennite) If you want to use their packages, add the following line Use only one of them, it could be potato, woody, testing (sarge) or (unstable) (sid) depending on the Debian release you are running, or it could be testing or unstable if you are running development releases. to your /etc/apt/sources.list: deb proto://url/debian potato main non-free deb proto://url/debian woody main non-free deb proto://url/debian testing main non-free deb proto://url/debian unstable main non-free

Where proto://url is one of the mirrors from the list available at . You need the main archive too since now there is a j2se-common package which resides there. If you had already installed j2sdk when the above dependency did not exist you would get warnings once you do an apt-get update or apt-get upgrade. For example, in Debian 3.0 using the main site (in the US) you would use: deb ftp://ftp.tux.org/pub/java/debian unstable non-free

And then do: $ apt-get update $ apt-get install j2sdk1.4

The packages will download all the library files into /usr/lib/j2se/, you just need to configure your system to use that jvm. If you use these Debian packages you will not need, for example, to configure your web browser: the symbolic links described in for libjavaplugin_oji.so will be created, as well as the alternative location of /usr/bin/java pointing to the j2se's Java.

Note that, at the moment of this writting, there are only Blackdown packages for unstable and testing of Java 1.4.

(contributed by Paul Reavis) If you download and install the JDK tar.gz files, unpack them into /usr/local/jdk1.1.x, and use symlinks to create a /usr/local/jdk and link in binaries to /usr/local/bin or whatever. It is not at all difficult to install these. However, you can get segfaults under some conditions depending on your libraries.

Here is a list of releases that are known to work under each Debian release, and what other software needed, if any, to make it happen. rex/bo: 1.1.5v7 (libc5). hamm:1.1.5v7 (glibc), also needed latest glibc from slink: 1.1.6-test2 (glibc). Making swing work in Debian

(from Paul Reavis) [A quickie on getting Swing working under Debian or any Linux really]

Yes, it does work with the linux JDK; Swing is 100% Pure Java (tm)(c)(SFD) and therefore should run under any compliant JVM. Paul Reavis reported converting a commercial app (350+ classes) over to a fully-Swing GUI; I've had no problems so far.

If you are using jdk 1.1.3 or below, all you need are the class files. So, the easiest thing to do is grab the solaris distribution, in tar.Z format, from javasoft. Depending on phase of moon, they either call it swing or JFC 1.1 (to distinguish from 1.2, which is part of Java 1.2). The current version is Swing 1.0.2 (not to be confused with Java 1.0.2!). If you are using jdk 1.2.2 do not download Swing (it is already integrated in the jdk).

I don't have the archive handy here, so we'll pretend it's named swing.tar.Z. It is recommended you install it in /usr/local. So skronk# cd /usr/local skronk# tar xzf /tmp/swing.tar.Z

Now you should have a /usr/local/swing directory. To test, make sure your JAVA_HOME variable is set, and CLASSPATH is unset, and run the "runnit" script in each example. To be painfully obvious, do this: skronk$ cd /usr/local/swing/examples/SwingSet skronk$ echo $JAVA_HOME /usr/local/jdk skronk$ unset CLASSPATH skronk$ echo $CLASSPATH skronk$ ./runnit

Of course, your directories, shell prompt, and mileage will vary. To use with your own applications, just add the jars you want to your classpath. Making Java 2 work in Debian

If you wish to use Sun's or Blackdown's jdk 1.2 or later in Debian download the packages provided by Blackdown (they are available in aptable directories) from the different mirrors available in (check the debian subdir). Currently there are i386 packages for the Java2 SDK and RE, JAI, Java3D and JMF. This is the recommended mechanism for more information read .

Or you can download the archives yourself (that is, the tar.gz, no the .deb package) and use the following mechanism: Make a directory under /usr/local (for example /usr/local/sun). Download the archine into this directory, then unpack it. A directory jdk1.X X will depend on the Java 2 version you are downloading, it can bee 1.2.1, 1.2.2, 1.3 or even 1.4 will be created. Adjust the alternatives to work correctly: update-alternatives --install /usr/bin/javac javac /usr/local/sun/jdk1.X/bin/javac 120 update-alternatives --install /usr/bin/java Java /usr/local/sun/jdk1.X/bin/java 120 Check your alternatives with "type" type javac type java

You should have now a fully working jdk 1.X environment, virtual machine and compiler included.

You might need to change your /etc/profile adding the proper definitions of some environment variables (CLASSPATH, JAVA_COMPILER and JAVA_HOME) so that Java programs can find the kit you just have installed. The following example show which settings you could add if you had installed Sun's 1.2.2 jdk: # JDK 1.2.2 (.tar) export CLASSPATH=.:/usr/local/sun/jdk1.2.2/lib:/usr/local/sun/jdk1.2.2/jre/lib export JAVA_COMPILER=javacomp export JAVA_HOME=/usr/local/sun/jdk1.2.2 export PATH=$PATH:/usr/local/sun/jdk1.2.2/bin

Note: As Juergen Kreileder correctly pointed me out The preferred name for versions >= 1.2 is Java 2 SE (Standard Edition). The jdk1.3 now is called "Java2 SDK v1.3" or "J2SDK 1.3". The jre1.3 now is called "Java2 RE v1.3" or "J2RE 1.3". How can I integrate Sun's J2SE SDK with Debian 3.1?

Warren Dodge explains how this can be done for Debian testing: the first step is to download the J2SE SDK components from into, e.g. /var/install/java/1.4.2. Make sure that you have write permission to the directory, and make the installer executable. Running the installer ./j2sdk-1_4_2_02-linux-i586.bin will create a directory j2sdk1_4_2_02 which can be moved to /usr/local/lib. Next, create a link ln -s /usr/local/lib/j2sdk1_4_2_02 /usr/local/lib/jdk which allows you to use the latter location to refer to the Java environment and makes upgrading a lot easier in the future.

Because Debian does not have an installer packages for Sun's J2SE, a dummy package needs to be made to let Debian know that a J2SE is installed. This is done as follows. Use the 'dummy' package control files provided by java-common to satisfy dependencies: mkdir -p /var/install/java/pkg cd /var/install/java/pkg cp /usr/share/doc/java-common/dummy-packages/*.control . equivs-build java-compiler-dummy.control equivs-build java-virtual-machine-dummy.control equivs-build java1-runtime-dummy.control equivs-build java2-compiler-dummy.control equivs-build java2-runtime-dummy.control

You should now have five packages in /var/install/java/pkg which should be installed.

The command update-alternatives is used in Debian to choose which of several pacakges to use when several can do the same thing. ("Java" can also be provided by kaffe, Blackdown (see above), etc). See "man update-alternatives" for more details. Use this command to install the programs you need with commands like: update-alternatives --verbose --install /usr/bin/java java /usr/local/lib/jdk/bin/java 500 \ --slave /usr/share/man/man1/java.1 java.1 /usr/local/lib/jdk/man/man1/java.1

Run java once as root to allow system preference directories to be created and to check if Sun's java is working properly: java -version How can I integrate Sun's J2SE SDK with Debian 3.0?

The procedure is similar to the one described for Debian 3.1 . However, the java-common in stable does not have the *.control files. Therefore, you need to install the java-common package from testing or unstable. Versions 0.19 and 0.20 can be safely be installed and require the installation of the equivs package, but the one from stable is just fine.

Notice, however, that newer J2SE versions (notably 1.4.2_04 instead of 1.4.1_02) might depend on newer libc6 or libgcc1 libraries. If you cannot backport (recompile) this package to your libraries you will need are limited to using jdk 1.3.1-11 (which requires libstdc++2.9-glibc2.1 from the oldlibs section). Java programs not yet available on Debian

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 might be packaged for Debian or those that someone is working on an installer for: BlueJ. A development environment for Java with editor, compiler, virtual machine and debugger. See Jacob (Java Commando Base): project maintainer and visualiser for Java in Emacs. See . Emacs in Java. See . Netbeans developer, now called Forte. Based on the Javabeans architecture. See .Sun recently announced they would open-source it. See . AnyJ. Graphic environment to develop applications, applets and servlets. More info in . Free Builder. A Java IDE written in Java and distributed under the GPL . Older Debian GNU/Linux versions

This appendix is included for historical reasons. It contains information that used to be in the FAQ (and indeed still is ;), but that only has historical value. Debian 2.2 'potato'

Libraries lib-fop-java lib-gnu.getopt-java lib-gnu.regexp-java lib-openxml-java lib-rxtx-java lib-sax-java lib-xp-java lib-xslp-java lib-xt-java lib-dom-java libpgjava libgcj0 bock Bootstrap-only compiler kit for a subset of Java(tm) doc++. A documentation system for C/C++ and Java fastjar a complete replacement for the jar utility written in C under the GPL (check . java2html. Highlits Java sources for WWW presentations. gcj The GNU compiler for Java(TM). global.Source code search and browse. guavac. A Java compiler. jikes. Fast Java compiler adhering to language and VM specifications jikes-pg.Jikes Parser Generator. oo-browser.Object Oriented (X)Emacs Class Browser. mmake.Makefile generator for Java programs. cocoon. A XML/XSL publishing framework servlet bsh A Java scripting environment. cup. LALR parser generator for Java. freetds-jdbc. Pure Java JDBC driver for MS SQL and Sybase. gnujsp. A free implementation of Sun's Java Server Pages (JSP 1.0) jlex.A Lex-style lexical analyser generator for Java jservJava Servlet 2.0 engine with an optional Apache module tya.JIT-compiler for Java. ibm-jdk1.1-installer. Installer for IBM Developer Kit for Linux, Java(TM) Technology Edition. jdk1.1.JDK 1.1.x (Java Development Kit) - Runtime only jdk1.1-dev JDK 1.1.x (Java Development Kit) biss-awt a Java GUI application programming framework. jdk1.1-native.JDK 1.1.x Runtime - native threads extensions jdk1.1-native-dev. JDK 1.1.x - native threads extensions. vrwave.VRML 2.0 java-based browser

Also many editors (jed, elvis, vim, emacs, fte, xcoral,zed ....) have support for Java syntax. Debian 2.1 'slink'

jdk 1.1.5v5 vrwave. A Java VRML browser. icq-java. An installer for the ICQJava program. jde. A Java Development Enviroment for Emacs . jlex. A lexical analyser generator similar to the UNIX lex. mmake. A generator of Makefiles for java programs. More info at libpgjava. A Java class that enables communication with the PostgreSQL database using JDBC. cup. A parser similar to yacc. ilu-javadev. Development header and libraries for the Inter-Language Unification System. I've installed the latest jde package...what I have to do to let Emacs enter jde-mode automatically when loading a Java source file?

As explained in /usr/doc/jde/README.Debian, all that is required is putting (require 'jde) into your ~/.emacs file.

Note that other add-on packages to Emacs are not enabled by default either, e.g., AucTeX. Debian 2.0 'hamm'

jdk 1.1.5v5 Debian 1.3.1 'bo'

jdk 1.0.2