old-www/LDP/www.debian.org/doc/manuals/debian-java-faq/ch4.html

467 lines
13 KiB
HTML
Raw Permalink Blame History

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>Debian Java FAQ. - Java Development</title>
<link href="index.html" rel="start">
<link href="ch-debian-java-squeeze.html" rel="prev">
<link href="ch5.html" rel="next">
<link href="index.html#contents" rel="contents">
<link href="index.html#copyright" rel="copyright">
<link href="ch1.html" rel="chapter" title="1 Introduction">
<link href="ch-debian-java-lenny.html" rel="chapter" title="2 Status of Java in Debian GNU/Linux 5.0 (Lenny)">
<link href="ch-debian-java-squeeze.html" rel="chapter" title="3 Status of Java in Debian Squeeze">
<link href="ch4.html" rel="chapter" title="4 Java Development">
<link href="ch5.html" rel="chapter" title="5 Managing Java (for users and administrators)">
<link href="ch6.html" rel="chapter" title="6 Java Virtual Machines (JVM)">
<link href="ch-browser-java.html" rel="chapter" title="7 Java Plugins for Browsers">
<link href="ch8.html" rel="chapter" title="8 Java Servlets">
<link href="ch9.html" rel="chapter" title="9 Java Policy">
<link href="ch10.html" rel="chapter" title="10 Other Java alternatives for Debian">
<link href="ch1.html#s1.1" rel="section" title="1.1 Introduction to this FAQ">
<link href="ch1.html#s1.2" rel="section" title="1.2 Location of this FAQ">
<link href="ch1.html#s-bugs" rel="section" title="1.3 Sending bugs on this FAQ">
<link href="ch1.html#s1.4" rel="section" title="1.4 What is Java?">
<link href="ch1.html#s1.5" rel="section" title="1.5 Where can I ask questions about Java on Debian?">
<link href="ch1.html#s-moreinfo" rel="section" title="1.6 Complementary information">
<link href="ch1.html#s-pending" rel="section" title="1.7 Uncovered issues">
<link href="ch-debian-java-lenny.html#s2.1" rel="section" title="2.1 What is new in Lenny?">
<link href="ch-debian-java-squeeze.html#s3.1" rel="section" title="3.1 What is new in Squeeze?">
<link href="ch-debian-java-squeeze.html#s3.2" rel="section" title="3.2 What are the most important changes in the Java policy?">
<link href="ch-debian-java-squeeze.html#s3.3" rel="section" title="3.3 What have been removed in Squeeze?">
<link href="ch4.html#s4.1" rel="section" title="4.1 What full-fledged Java development platforms are available in Debian?">
<link href="ch4.html#s-free" rel="section" title="4.2 What free platforms are there and how can I contribute?">
<link href="ch4.html#s-license-concerns" rel="section" title="4.3 Questions on platforms and license concerns">
<link href="ch4.html#s4.4" rel="section" title="4.4 Making Debian packages for Java programs.">
<link href="ch6.html#s6.1" rel="section" title="6.1 What JVMs are available in Debian?">
<link href="ch6.html#s6.2" rel="section" title="6.2 What Java Compilers are available in Debian?">
<link href="ch6.html#s6.3" rel="section" title="6.3 What API do these JVMs provide?">
<link href="ch6.html#s6.4" rel="section" title="6.4 Are there known problems?">
<link href="ch6.html#s6.5" rel="section" title="6.5 Do I need a JVM to run a Java program in Debian?">
<link href="ch8.html#s8.1" rel="section" title="8.1 How can I make Java servlets work?">
<link href="ch9.html#s9.1" rel="section" title="9.1 Is there a Java policy for Debian?">
<link href="ch9.html#s9.2" rel="section" title="9.2 Are there holes in the Java Policy?">
<link href="ch10.html#s10.1" rel="section" title="10.1 Java programs not yet available on Debian">
<link href="ch4.html#s-java56" rel="subsection" title="4.3.1 Java 5 and 6">
<link href="ch4.html#s-openjdk" rel="subsection" title="4.3.2 Sun's OpenJDK">
<link href="ch4.html#s4.4.1" rel="subsection" title="4.4.1 Can the package go into main?">
<link href="ch4.html#s4.4.2" rel="subsection" title="4.4.2 Is there a good example Debian package?">
<link href="ch4.html#s4.4.3" rel="subsection" title="4.4.3 What tools are available to make maintaining a Java packages easier?">
<link href="ch4.html#s4.4.4" rel="subsection" title="4.4.4 Linking package Javadoc to system javadoc.">
<link href="ch6.html#s6.5.1" rel="subsection" title="6.5.1 How do I compile to native code?">
</head>
<body>
<p><a name="ch4"></a></p>
<hr>
<p>
[ <a href="ch-debian-java-squeeze.html">previous</a> ]
[ <a href="index.html#contents">Contents</a> ]
[ <a href="ch1.html">1</a> ]
[ <a href="ch-debian-java-lenny.html">2</a> ]
[ <a href="ch-debian-java-squeeze.html">3</a> ]
[ 4 ]
[ <a href="ch5.html">5</a> ]
[ <a href="ch6.html">6</a> ]
[ <a href="ch-browser-java.html">7</a> ]
[ <a href="ch8.html">8</a> ]
[ <a href="ch9.html">9</a> ]
[ <a href="ch10.html">10</a> ]
[ <a href="ch5.html">next</a> ]
</p>
<hr>
<h1>
Debian Java FAQ.
<br>Chapter 4 - Java Development
</h1>
<hr>
<hr>
<h2><a name="s4.1"></a>4.1 What full-fledged Java development platforms are available in Debian?</h2>
<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:
</p>
<ul>
<li>
<p>
The deprecated Kaffe in Debian 5.0 Lenny.
</p>
</li>
</ul>
<ul>
<li>
<p>
The deprecated Sun Java 5 jdk, available in the Debian 5.0 <em>Lenny</em>
release in the <em>non-free</em> component.
</p>
</li>
</ul>
<ul>
<li>
<p>
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.
</p>
</li>
</ul>
<ul>
<li>
<p>
Sun's OpenJDK 6, available since the Debian 5.0 <em>Lenny</em> release in the
<em>main</em> section.
</p>
</li>
</ul>
<ul>
<li>
<p>
The combination GCJ, GIJ, and Classpath in the <em>main</em> section.
</p>
</li>
</ul>
<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.
</p>
<hr>
<h2><a name="s-free"></a>4.2 What free platforms are there and how can I contribute?</h2>
<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:
</p>
<ul>
<li>
<p>
openjdk: <code><a
href="http://openjdk.java.net/">http://openjdk.java.net/</a></code>
</p>
</li>
</ul>
<ul>
<li>
<p>
gcj and libgcj: <code><a
href="http://gcc.gnu.org/java/">http://gcc.gnu.org/java/</a></code>
</p>
</li>
</ul>
<ul>
<li>
<p>
FastJar <code><a
href="http://savannah.nongnu.org/projects/fastjar">http://savannah.nongnu.org/projects/fastjar</a></code>,
as a jar tool.
</p>
</li>
</ul>
<ul>
<li>
<p>
Classpath <code><a
href="http://www.classpath.org">http://www.classpath.org</a></code>. 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.
(NB: This was removed from Squeeze)
</p>
</li>
</ul>
<ul>
<li>
<p>
Mauve <code><a
href="http://sources.redhat.com/mauve/">http://sources.redhat.com/mauve/</a></code>
is a free suite to test if these tools are 'compliant'.
</p>
</li>
</ul>
<p>
Most free Java development is grouped under the <code><a
href="http://www.gnu.org/software/java/">Free Java Project</a></code>.
</p>
<hr>
<h2><a name="s-license-concerns"></a>4.3 Questions on platforms and license concerns</h2>
<hr>
<h3><a name="s-java56"></a>4.3.1 Java 5 and 6</h3>
<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
appropriately. If you have the following in your
<code>/etc/apt/sources.list</code>:
</p>
<pre>
deb http://ftp.debian.org/debian lenny main
</pre>
<p>
you need to change it to:
</p>
<pre>
deb http://ftp.debian.org/debian lenny main contrib non-free
</pre>
<p>
Once this is done and you have updated your package database. You can either
install the Java development kit:
</p>
<pre>
apt-get install sun-java6-jdk
</pre>
<p>
or the Java runtime environment:
</p>
<pre>
apt-get install sun-java6-jre
</pre>
<p>
Similarly, you can install the Java 5 development kit:
</p>
<pre>
apt-get install sun-java5-jdk
</pre>
<p>
or the Java 5 runtime environment:
</p>
<pre>
apt-get install sun-java5-jre
</pre>
<p>
You might want to update the alternatives system to have Sun's tools as the
default:
</p>
<pre>
update-java-alternatives -s java-6-sun
</pre>
<p>
Or for java 5:
</p>
<pre>
update-java-alternatives -s java-1.5.0-sun
</pre>
<hr>
<h3><a name="s-openjdk"></a>4.3.2 Sun's OpenJDK</h3>
<p>
Sun adopted in november 2006 the GPL license for almost all of the virtual
machine and GPL v2 + the <em>Classpath exception</em>[<a
href="footnotes.html#f1" name="fr1">1</a>]for the class libraries and those
parts of the virtual machine that expose public APIs.
</p>
<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:
</p>
<pre>
apt-get install openjdk-6-jdk
</pre>
<p>
or the Java runtime environment:
</p>
<pre>
apt-get install openjdk-6-jre
</pre>
<p>
For more information see <code><a
href="http://www.sun.com/software/opensource/java/faq.jsp">Free and Open Source
Java</a></code>.
</p>
<hr>
<h2><a name="s4.4"></a>4.4 Making Debian packages for Java programs.</h2>
<hr>
<h3><a name="s4.4.1"></a>4.4.1 Can the package go into main?</h3>
<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>
<hr>
<h3><a name="s4.4.2"></a>4.4.2 Is there a good example Debian package?</h3>
<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>
<p>
A good start would be to check out the pkg-java project on Alioth: <code><a
href="http://pkg-java.alioth.debian.org/">http://pkg-java.alioth.debian.org/</a></code>.
</p>
<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: <code><a
href="http://pkg-java.alioth.debian.org/developers.html#rules">http://pkg-java.alioth.debian.org/developers.html#rules</a></code>
and <code><a
href="http://pkg-java.alioth.debian.org/building.html">http://pkg-java.alioth.debian.org/building.html</a></code>.
</p>
<hr>
<h3><a name="s4.4.3"></a>4.4.3 What tools are available to make maintaining a Java packages easier?</h3>
<p>
Both cdbs and debhelper (dh7) have support for ant scripts. There are also a
number of specialized tools or build helpers. Have a look at
<code>javahelper</code> or <code>maven-debian-helper</code>.
<code>gcj-jdk</code> also has a dh_javadoc tool.
</p>
<hr>
<h3><a name="s4.4.4"></a>4.4.4 Linking package Javadoc to system javadoc.</h3>
<p>
The java-policy mandates that documentation must be linked with the javadoc
installed on the system. This can be done by passing javadoc the
&quot;-link&quot; argument or by using the &lt;link&gt; tag in ant. An
example:
</p>
<pre>
# command line example of linking against system doc.
javadoc -link /usr/share/doc/default-jdk-doc/api [other arguments]
&lt;!-- Ant example of linking against system doc --&gt;
&lt;javadoc [attributes]&gt;
&lt;link href=&quot;/usr/share/doc/default-jdk-doc/api/&quot; /&gt;
[other tags]
&lt;/javadoc&gt;
</pre>
<p>
The documentation must be installed at the time the linking is done; so in the
example cases above the package would need a Build-Depends or a
Build-Depends-Indep on <code>default-jdk-doc</code>.
</p>
<p>
Here is a short list of packages that can be used for reference:
</p>
<ul>
<li>
<p>
<code>commons-jci</code>
</p>
</li>
</ul>
<ul>
<li>
<p>
<code>ow-util-ant-tasks</code>
</p>
</li>
</ul>
<ul>
<li>
<p>
<code>libhamcrest-java</code>
</p>
</li>
</ul>
<ul>
<li>
<p>
<code>libfreemarker-java</code>
</p>
</li>
</ul>
<hr>
<p>
[ <a href="ch-debian-java-squeeze.html">previous</a> ]
[ <a href="index.html#contents">Contents</a> ]
[ <a href="ch1.html">1</a> ]
[ <a href="ch-debian-java-lenny.html">2</a> ]
[ <a href="ch-debian-java-squeeze.html">3</a> ]
[ 4 ]
[ <a href="ch5.html">5</a> ]
[ <a href="ch6.html">6</a> ]
[ <a href="ch-browser-java.html">7</a> ]
[ <a href="ch8.html">8</a> ]
[ <a href="ch9.html">9</a> ]
[ <a href="ch10.html">10</a> ]
[ <a href="ch5.html">next</a> ]
</p>
<hr>
<p>
Debian Java FAQ.
</p>
<address>
$Revision: 7831 $, $Date: 2010-12-04 20:17:15 +0000 (Sat, 04 Dec 2010) $<br>
<br>
Torsten Werner <code><a href="mailto:twerner@debian.org">twerner@debian.org</a></code><br>
Niels Thykier <code><a href="mailto:niels@thykier.net">niels@thykier.net</a></code><br>
Javier Fern<72>ndez-Sanguino Pe<50>a <code><a href="mailto:jfs@debian.org">jfs@debian.org</a></code><br>
<br>
</address>
<hr>
</body>
</html>