Differences between revisions 23 and 49 (spanning 26 versions)
Revision 23 as of 2009-08-04 18:51:47
Size: 2376
Comment: removed auto-conversion comment
Revision 49 as of 2017-06-12 20:40:32
Size: 5895
Editor: Francewhoa
Comment: Added 2 potential errors to ignore to "update-java-alternatives" section
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
[[Java]] #language en
~-[[DebianWiki/EditorGuide#translation|Translation(s)]]: English - [[es/JavaPackage|español]]-~
Line 3: Line 4:
JavaPackage is a utility for packaging a non-free Java™ 2 Standard Edition (J2SE) Java™ Runtime Environment ([[JRE]]) or Java™ Development Kit ([[JDK]]) as a Debian package. JavaPackage provides the capability to create a Debian package from a Java™ 2 distribution simply by executing
{{{
$ fakeroot make-jpkg <filename>
}}}
'''NOTE''':
 * Debian recommends the use of OpenJDK packages ([[DebianPkg:openjdk-7-jdk]] / [[DebianPkg:openjdk-7-jre]]) instead of non-free packages created by this utility.
----
Line 8: Line 8:
This program works currently with [[JRE]]s and [[JDK]]s from SunJava (1.3 JRE, 1.4 and 1.5), [[IBMJava]] (1.3, 1.4 and 1.5 beta) and BlackDownJava (1.3 and 1.4). It also works with the API Javadoc from Sun (1.3, 1.4 and 1.5). DebianPkg:java-package provides the ability to build a Debian package from a Java binary distribution by running {{{make-jpkg <java binary archive file>}}} (with archive files downloaded from providers listed below).
Should your interest be more on the development with Java under Debian, then follow the [[Java]] link. To learn more about the packaging of Java-written programs and libraries for Debian, see [[Teams/JavaPackaging]].
Line 10: Line 11:
It will make a .[[deb]] out of .bin files from Sun or Blackdown and .tar.gz files from IBM, as well as the .zip files for Sun's API Javadoc. The package includes the [[DebianMan:1/make-jpkg|make-jpkg]] command to do this.
Typical usage consists in:
 * downloading one of the java binary archive listed below
 * invoking make-jpkg to build a Debian package from the downloaded archive
 * installing the generated package

Supported Java binary distributions currently include:
 * Oracle (http://www.oracle.com/technetwork/java/javase/downloads):
  * The Java Development Kit (JDK), version 6, 7 and 8
  * The Java Runtime Environment (JRE), version 6, 7 and 8
  * The Java API Javadoc, version 6, 7 and 8
Line 13: Line 24:
{{{apt-get install java-package}}}
(see [[DebianPackageManagement]], note that java-package is not in the {{{main}}} sources, you need to add {{{contrib}}} to your {{{/etc/apt/sources.list}}} ),
Line 16: Line 25:
{{{
fakeroot make-jpkg jre-1_5_0-linux-i586.bin

dpkg -i sun-j2re1.5_1.5.0+final_i386.deb
 1. Add a "contrib" component to {{{/etc/apt/sources.list}}}, for example: {{{
# Debian 8 "Jessie"
deb http://httpredir.debian.org/debian/ jessie main contrib
Line 21: Line 29:
See: http://serios.net/content/debian/java.php#gettingstarted


See also:

 * DebPkg:free-java-sdk
 * http://people.debian.org/~tora/java/packagelist.html
 * [[DebPkg:java-package|Debian JavaPackage official description]].
 * FakeRoot
 1. Update the list of available packages and install the DebianPkg:java-package package: {{{
# apt-get update && apt-get install java-package && exit
}}}
 1. Download the desired Java JDK/JRE binary distribution ([[http://www.oracle.com/technetwork/java/javase/downloads|Oracle]]). Choose tar.gz archives or self-extracting archives, do __not__ choose the RPM!
 1. Use java-package to create a Debian package, for example: {{{
$ make-jpkg jdk-8u51-linux-x64.tar.gz
}}}
 1. Install the binary package created: {{{
$ su
# dpkg -i oracle-java8-jdk_8u51_amd64.deb
}}}
Line 34: Line 44:
The Sun Java version as packaged by the java-package make-jpkg will produce a package with a quite high priority alternative.
Line 41: Line 50:
sudo update-alternatives --auto java # update-alternatives --auto java
Line 47: Line 56:
update-alternatives --display java
sudo update-alternatives --config java
# update-alternatives --display java
# update-alternatives --config java
Line 53: Line 62:
The appropriate java binary will automatically be in PATH by virtue of the /usr/bin/java alternative symlink. The appropriate java binary will automatically be in PATH by virtue of the {{{/usr/bin/java}}} alternative symlink.
Line 55: Line 64:
You may also use the update-alternatives tool from DebianPkg:java-common package which lets you update all alternatives belonging to one runtime/development kit at a time. Steps to do so:

 1. List the Java alternatives presently installed and available on your system
    {{{
# sudo update-java-alternatives -l
    }}}

 1.#2 Set the default Java and update all alternatives
    {{{
# sudo update-java-alternatives -s <alternative>
    }}}

        {{{#!wiki note
Notes
 * Where '''''<alternative>''''' is the default Java. For example '''''java-1.8.0-openjdk-amd64''''' or '''''jdk-8-oracle-x64'''''
 * This command will register all the java executables. And create symlinks for each of them.
 * If Terminal return any of the following errors, ignore them. Because IceaTea 8 isn't ready yet and those errors are about browser plugin only.
   * '''''error: no alternatives for mozilla-javaplugin.so'''''
   * '''''plugin alternative does not exist: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/IcedTeaPlugin.so'''''
    }}}

== Troubleshooting ==
=== Building process keeps crashing on override_dh_shlibdeps target ===
This problems is due to missing dependencies of {{{java-package}}} package (related issue: DebianBug:782132). To fix it simply run as root:

{{{
# apt-get install libgl1-mesa-glx libfontconfig1 libxslt1.1 libxtst6 libxxf86vm1 libgtk2.0-0
}}}
=== Building Oracle Java 6 From jdk-6u45-linux-x64.bin ===
 *Failure target is {{{override_dh_shlibdeps}}} as above
 *{{{java-package}}} versions 0.56 and 0.61 both have
  *{{{Build-Depends: debhelper (>= 9), libasound2, libgl1-mesa-glx, libgtk2.0-0, libxslt1.1, libxtst6, libxxf86vm1}}}
 *but omits {{{libxt6}}}
 *{{{libfontconfig1}}} from above is not required
 *Build requires:
{{{
# apt-get install libgl1-mesa-glx libgtk2.0-0 libxslt1.1 libxtst6 libxxf86vm1 libxt6
}}}

=== Building Oracle Java 8 on wheezy ===
 
When running {{{make-jpkg}}} on wheezy (i686) you can get this message:{{{

notroot@debian:~$ fakeroot make-jpkg /home/notroot/jdk-8u101-linux-i586.tar.gz
Creating temporary directory: /tmp/make-jpkg.dUA0X8ychf
Loading plugins: /usr/share/java-package/common.sh /usr/share/java-package/j2re.sh /usr/share/java-package/j2sdk-doc.sh /usr/share/java-package/j2sdk.sh /usr/share/java-package/j2se.sh /usr/share/java-package/oracle-j2re.sh /usr/share/java-package/oracle-j2sdk-doc.sh /usr/share/java-package/oracle-j2sdk.sh

Detected Debian build architecture: i386
Detected Debian GNU type: i486-linux-gnu

No matching plugin was found.
Removing temporary directory: done
}}}

This can be fixed by installing the backports version of the java-package. {{{apt-get install -t wheezy-backports java-package}}} installs the package if backports are configured correctly.
(idea based on [[https://bugs.debian.org/750092#15|bug #750092]])

Translation(s): English - español


NOTE:

  • Debian recommends the use of OpenJDK packages (openjdk-7-jdk / openjdk-7-jre) instead of non-free packages created by this utility.


java-package provides the ability to build a Debian package from a Java binary distribution by running make-jpkg <java binary archive file> (with archive files downloaded from providers listed below). Should your interest be more on the development with Java under Debian, then follow the Java link. To learn more about the packaging of Java-written programs and libraries for Debian, see Teams/JavaPackaging.

The package includes the make-jpkg command to do this. Typical usage consists in:

  • downloading one of the java binary archive listed below
  • invoking make-jpkg to build a Debian package from the downloaded archive
  • installing the generated package

Supported Java binary distributions currently include:

Process

  1. Add a "contrib" component to /etc/apt/sources.list, for example:

    # Debian 8 "Jessie"
    deb http://httpredir.debian.org/debian/ jessie main contrib
  2. Update the list of available packages and install the java-package package:

    # apt-get update && apt-get install java-package && exit
  3. Download the desired Java JDK/JRE binary distribution (Oracle). Choose tar.gz archives or self-extracting archives, do not choose the RPM!

  4. Use java-package to create a Debian package, for example:

    $ make-jpkg jdk-8u51-linux-x64.tar.gz
  5. Install the binary package created:

    $ su
    # dpkg -i oracle-java8-jdk_8u51_amd64.deb

Configuration

By default the DebianAlternatives will automatically install the best version of Java as the default version. If the symlinks have been manually set they will be preserved by the tools. The update-alternatives tools try hard to respect explicit configuration from the local admin. Local manual symlinks appear to be an explicit configuration. In order to reset the alternative symlinks to their default value use the --auto option.

# update-alternatives --auto java

If you'd like to override the default to perhaps use a specific version then use --config and manually select the desired version.

# update-alternatives --display java
# update-alternatives --config java 

Choose the appropriate number for the desired alternative.

The appropriate java binary will automatically be in PATH by virtue of the /usr/bin/java alternative symlink.

You may also use the update-alternatives tool from java-common package which lets you update all alternatives belonging to one runtime/development kit at a time. Steps to do so:

  1. List the Java alternatives presently installed and available on your system
    • # sudo update-java-alternatives -l
  2. Set the default Java and update all alternatives
    • # sudo update-java-alternatives -s <alternative>
      • Notes

        • Where <alternative> is the default Java. For example java-1.8.0-openjdk-amd64 or jdk-8-oracle-x64

        • This command will register all the java executables. And create symlinks for each of them.
        • If Terminal return any of the following errors, ignore them. Because ?IceaTea 8 isn't ready yet and those errors are about browser plugin only.

          • error: no alternatives for mozilla-javaplugin.so

          • plugin alternative does not exist: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/IcedTeaPlugin.so

Troubleshooting

Building process keeps crashing on override_dh_shlibdeps target

This problems is due to missing dependencies of java-package package (related issue: 782132). To fix it simply run as root:

# apt-get install libgl1-mesa-glx libfontconfig1 libxslt1.1 libxtst6 libxxf86vm1 libgtk2.0-0

Building Oracle Java 6 From jdk-6u45-linux-x64.bin

  • Failure target is override_dh_shlibdeps as above

  • java-package versions 0.56 and 0.61 both have

    • Build-Depends: debhelper (>= 9), libasound2, libgl1-mesa-glx, libgtk2.0-0, libxslt1.1, libxtst6, libxxf86vm1

  • but omits libxt6

  • libfontconfig1 from above is not required

  • Build requires:

# apt-get install libgl1-mesa-glx libgtk2.0-0 libxslt1.1 libxtst6 libxxf86vm1 libxt6

Building Oracle Java 8 on wheezy

When running make-jpkg on wheezy (i686) you can get this message:

notroot@debian:~$ fakeroot make-jpkg /home/notroot/jdk-8u101-linux-i586.tar.gz
Creating temporary directory: /tmp/make-jpkg.dUA0X8ychf
Loading plugins: /usr/share/java-package/common.sh /usr/share/java-package/j2re.sh /usr/share/java-package/j2sdk-doc.sh /usr/share/java-package/j2sdk.sh /usr/share/java-package/j2se.sh /usr/share/java-package/oracle-j2re.sh /usr/share/java-package/oracle-j2sdk-doc.sh /usr/share/java-package/oracle-j2sdk.sh

Detected Debian build architecture: i386
Detected Debian GNU type: i486-linux-gnu

No matching plugin was found.
Removing temporary directory: done

This can be fixed by installing the backports version of the java-package. apt-get install -t wheezy-backports java-package installs the package if backports are configured correctly. (idea based on bug #750092)


CategoryJava