Debian Java FAQ. Torsten Werner twerner@debian.org Niels Thykier niels@thykier.net Javier Fernández-Sanguino Peña jfs@debian.org $Revision: 7297 $, $Date: 2010-04-15 23:31:12 +0200 (Thu, 15 Apr 2010) $ 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 Debian Bug Tracking System 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. 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 still outdated but gets updated step by step.

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 before filing a bug report. Translations, if available, and the offline version in the java-common package might be out of date. What is Java?

Java is a programming language originally developed by James Gosling at Sun Microsystems (which is now a subsidiary of Oracle Corporation) and released in 1995 as a core component of Sun Microsystems' Java platform. More information can be found at . 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. 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 to work with /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. Status of Java in Debian GNU/Linux 5.0 (Lenny) What is new in Lenny?

The Lenny release was the first one to provide Sun's OpenJDK environment (see ). 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.

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.

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. Status of Java in Debian Squeeze What is new in Squeeze?

The information in this chapter is probably out of date as Squeeze is not yet released and changes rapidly.

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

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.

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. 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. What have been removed in Squeeze?

This is an incomplete list of packages removed from Squeeze: kaffe cacao jamvm liblogkit-java (Replaced by libexcalibur-logkit-java) liblucene-java (Replaced by liblucene2-java) jmp (Replaced by tijmp) pja slide-webdavclient java-package

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: The deprecated Kaffe in Debian 5.0 Lenny. The deprecated Sun Java 5 jdk, available in the Debian 5.0 Lenny release in the non-free component. Sun's Java 6 jdk, available in Debian Lenny and Debian Squeeze, also as packages in the non-free component. Sun's OpenJDK 6, available since the Debian 5.0 Lenny release in the main section. The combination GCJ, GIJ, and Classpath in the main section.

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. 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: gcj and libgcj: FastJar , as a jar tool. Classpath . 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. Mauve is a free suite to test if these tools are 'compliant'.

Most free Java development is grouped under the . 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 appropriately. If you have the following in your /etc/apt/sources.list: deb http://ftp.debian.org/debian lenny main you need to change it to: deb http://ftp.debian.org/debian lenny 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

Similarly, you can install the Java 5 development kit: apt-get install sun-java5-jdk or the Java 5 runtime environment: apt-get install sun-java5-jre

You might want to 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 license 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 . Making Debian packages for Java programs. 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. 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 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?

openjdk-6-jdk sun-java6-jdk (non-free) gcj. Compiles Java source to native code, also source to bytecode, or bytecode to native code. The deprecated jikes in Lenny. Java Virtual Machines (JVM)

What jvms work in Debian?

Currently Sun's jvm works in Debian. Another solution is to use gcj and to compile to native code, thus solving the VM problem.) What free JVMs are available in Debian?

The following JVMs are currently available in Debian Squeeze: openjdk-6-jre sun-java6-jre (non-free) gij-4.3

The following lists JVMs available in Debian 5.0 release ('Lenny'): kaffe gij-4.3 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. 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 to compile the program. And use gcj to convert bytecode to native code. The entire software chain is free. Java Plugins for Browsers

You can install the package icedtea-gcjwebplugin or the non-free packages sun-java5-plugin or sun-java6-plugin in Lenny. You can install the package icedtea6-plugin or the non-free package sun-java6-plugin in Squeeze. Java Servlets

How can I make Java servlets work?

You can use: Apache tomcat6 from . Eclipse jetty from . 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. 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 .