Java

Differences between revisions 19 and 41 (spanning 22 versions)
Revision 19 as of 2006-06-09 03:18:45
Size: 36161
Editor: S0106000fb085cc63
Comment: page dump of all java pages
Revision 41 as of 2008-08-06 16:24:58
Size: 48
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:

Included in the main section of Ubuntu is the {{{java-gcj-compat}}} package; several solutions are available to install the Blackdown, IBM and Sun Java runtime environments and development kits.

Thanks to a redistribution license change from Sun, official Sun java packages are now available in the ''multiverse'' repositories.

=== Ubuntu 6.06 ===

 * Sun Java5: Install it from the {{{Applications}}} -> {{{Add/Remove...}}} menu, or install the {{{sun-java5-bin}}} package.

 * Blackdown Java2 1.4 packages: Install the {{{j2re1.4}}} package, available in the ''multiverse'' repositories. Install it from the {{{Applications}}} -> {{{Add/Remove...}}} menu, or install the {{{j2re1.4}}} package.

=== Kubuntu 6.06 ===

 * Sun Java5: Using your favourite package manager, install the {{{sun-java5-bin}}} package.

 * Blackdown Java2 1.4 packages: Using your favourite package manager, install the {{{j2re1.4}}} package, available in the ''multiverse'' repositories.

=== Ubuntu/Kubuntu 5.10 ===

 * For Ubuntu/Kubuntu 5.10 (Breezy Badger), the easiest method is to use the Blackdown Java 1.4 installer from Multiverse. To install Java with the installer, just install the {{{j2re1.4}}} package.

 * Ubuntu PPC, please see: ["JavaPPC"]. Ubuntu AMD64, please see: ["JavaAMD64"].

== Sun Java directly from Sun ==

Note: See above for the preferred method installing the non-free / restricted Java packages.

The alternative method it to get the latest version from Sun. This version of Java works better for most applications. Sun's implementation of Java and Java plugin for browsers however is non-free. Free Java is in active development and will be the preferred choice once it is released.

Blackdown Java is non-free. It is a direct port of Sun's Java implementation, and is subject to the same licenses, as stated in the [http://www.blackdown.org/java-linux/docs/faq/FAQ-java-linux-2.html#intro-licensing Blackdown FAQ]. The only current advantage of using Blackdown over Sun is that Blackdown is to have the the i386 package show up in apt. Those interested in a free (GPL) Java implementation may wish to look at [http://www.kaffe.org/ Kaffe], which is available in the universe repository.

Go to http://java.sun.com/j2se/1.5.0/download.jsp and click on “'''Download JRE 5.0 Update 7'''”. Ensure you do ''not'' choose one of the JDK or J2EE versions unless you are going to develop Java applications.

You must first accept the licence, then click on “'''Linux self-extracting file'''” (jre-1_5_0_07-linux-i586.bin). Save this file to your hard drive.

Make the downloaded file executable. At the command line, change to the directory where you downloaded the file, and type:
{{{
  chmod +x jre-1_5_0_07-linux-i586.bin
}}}

Install the {{{install fakeroot java-package java-common}}} packages.

If you get an error when installing java-package, you need to enable the multiverse repository (see ["AddingRepositoriesHowto"]).

Use ''make-jpkg'' to translate Sun's bin file into a debian package:
{{{
  fakeroot make-jpkg jre-1_5_0_07-linux-i586.bin
}}}

{i} ''Note: You can see warning mesages like the ones below, but there is nothing to worry about.''
{{{
  mkdir: cannot create directory `/etc/.java': Permission denied
  ./jdk-1_5_0_07-linux-i586.bin: line 507: /usr/share/mime-info/java-archive.keys: Permission denied
}}}

{X} ''Note: If you get an error similar to this:''
{{{
  Loading plugins: blackdown-j2re.sh blackdown-j2sdk.sh common.sh ibm-j2re.sh ibm-j2sdk.sh j2re.sh j2sdk.sh j2se.sh sun-j2re.sh sun-j2sdk.sh

  No matching plugin was found.
}}}

Try:
{{{
  DEB_BUILD_GNU_TYPE=i386-linux fakeroot make-jpkg jre-1_5_0_07-linux-i586.bin
}}}

or similar command if you are not using i386 architecture.

Install the created package using ''dpkg'':
{{{
  sudo dpkg -i sun-j2re1.5_1.5.0+update07_i386.deb
}}}

{i} Note: in above example, ''i386'' might have to be ''i586''.

=== Sun Java SDK (Software Development Kit) ===

Note: Outdated; see above for the preferred method to install the sun-java5 packages. Install the
{{{sun-java5-jdk}}} or {{{j2sdk1.4}}} package.

The same procedure can also be used to install Sun's Java SDK instead of just the runtime environment (JRE). Just choose "'''Download JDK 5.0 Update 7'''" when downloading the package from Sun, and replace the file name with '''jdk-1_5_0_07-linux-i586.bin'''

== Selecting the default Java version ==

In Ubuntu 6.06 or 5.10, if you want to use Sun's Java instead of the open source GIJ (GNU Java bytecode interpreter) you need to set it as default. Run:
{{{
  sudo update-alternatives --config java
}}}
and select your preference from the list.

{i} ''Note: You probably want to do the same with jar, javac, javadoc, javah, javap and javaws:
{{{
  sudo update-alternatives --config jar
}}}

To get common java applications (installed using .deb-packages) to run under your JVM of choice, make sure you also edit the JVM configuration file:
{{{
  sudo nano /etc/jvm
}}}
and add the line:
{{{
  /usr/lib/j2sdk1.5-sun
}}}
Packages such as '''ant''' starts the first JVM found in this file.

=== Sun Java J2EE SDK ===

Note: Outdated; see above for the preferred method to install the sun-java5 packages.

At the moment, there's no possibility to create a deb as described above for the J2EE SDK
so you have to download the jdk from the site http://java.sun.com and then install the {{{ libstdc++2.10-dev}}} package.
then install as user the binary file that you have downloaded before.

{i} Note:Remember to add the jar j2ee.jar in your IDE e.g. eclipse if you want to develop JSP and/or Servlet

== Java on Konqueror ==

You may find that Java is disabled, even though it is set up correctly in the "Configure Konqueror" Dialog. Select "HTML Settings->Java" from the Tools menu to enable it.

== Java on Mozilla Firefox ==

Note: Outdated; see above for the preferred method to install the sun-java5 packages. Install the {{{sun-java5-plugin}}} package.

Installing Java without following the previous steps does not alert Firefox to its presence. If you simply executed the .bin file you downloaded, you will need to tell Firefox or Mozilla where to find the plugin library:

If you do not have a .mozilla/plugins directory in your home directory, create one:
{{{
mkdir -p /home/username/.mozilla/plugins
}}}

Then create links to plugin files:
{{{
  cd ~/.mozilla/plugins
  ln -s /usr/lib/j2re1.5-sun/plugin/i386/ns7/libjavaplugin_oji.so libjavaplugin_oji.so
  sudo ln -s /usr/lib/j2re1.5-sun/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/mozilla-firefox/plugins/
}}}

You can skip these steps if you used the make-jpkg command.

If you have downloaded more than one, you need to modify the command to be more specific.

Note:
For 6.06 Dapper the links have changed (at least for the installation via the new licence package), so try this:
{{{
cd ~/.mozilla/plugins

ln -s /usr/lib/jvm/java-1.5.0-sun/jre/plugin/i386/ns7/libjavaplugin_oji.so libjavaplugin_oji.so

sudo ln -s /usr/lib/jvm/java-1.5.0-sun/jre/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/firefox/plugins/
}}}
== Java on amd64 computers ==

Note: Outdated; see above for the preferred method to install the sun-java5 and j2re1.4/j2sdk1.4 packages.

Unfortunately, Sun's Java for 64-bit PC's does't work very well yet, but the Blackdown version of Java works and is available in the Ubuntu 5.10 (Breezy Badger) Multiverse repository. Just install the {{{j2re1.4 j2re1.4-mozilla-plugin}}}

Afterwards restart Firefox and you should have a working Java plugin.

== AMD64 ==

'''Note: This page is only for users of Ubuntu 5.04. Users of Ubuntu 5.10 and 6.06 should see RestrictedFormats for the Sun Java5 and Blackdown Java2 1.4 packages.'''

= Java Runtime Environment and Firefox plugin for amd64 =

Installing the Java Runtime Environment (JRE) in the amd64 version of Ubuntu 5.04 is (as of September 2005) not possible using apt-get and must be done manually. As Sun now provide an amd64 version, users may choose between Sun's and Blackdown's versions of the JRE. Note, however, that as of version 1.5, Sun does not include a Mozilla/Firefox plugin so if this is required, you'll need to use the one from Blackdown.

The JRE (both from Sun and Blackdown) is packaged in a self-extracting binary file. This gives us two possibilities for installing. The first is to run the installer as intended by the vendor. This method should work, but will install files into the system which are outside the grasp of apt, potentially making it harder to upgrade or track down the changes. The second method is to use some tools to create a .deb file of the package which we can then install using "dpkg -i <name>.deb". This makes it simple to remove or update the package at a later date.

Both methods should work equally for the Blackdown and Sun versions. In this document we will assume you are using the Blackdown version j2re-1.4.2-02 available here: [ ftp://ftp.tux.org/pub/java/JDK-1.4.2/amd64/02/j2re-1.4.2-02-linux-amd64.bin ]. If you download a different version, please adjust the version number accordingly. The Sun JRE is available here: [ http://java.sun.com/j2se/1.5.0/download.jsp ].

== Method one ==

Make the self-extracting shell script executable

{{{
$ sudo chmod +x j2re-1.4.2-02-linux-amd64.bin
}}}

Move the package to the desired install directory

{{{
$ sudo mv j2re-1.4.2-02-linux-amd64.bin /usr/local
}}}

Change to the wanna-be install directory

{{{
$ cd /usr/local
}}}

Extract the contents of the package

{{{
$ sudo ./j2re-1.4.2-02-linux-amd64.bin
}}}

== Method two ==

Install some tools for converting the Java package into a .deb file:
{{{
$ sudo apt-get install fakeroot java-package
}}}

Make the self-extracting shell script executable

{{{
$ chmod +x j2re-1.4.2-02-linux-amd64.bin
}}}

Convert the package to a .deb file:
{{{
$ fakeroot make-jpkg j2re-1.4.2-02-linux-amd64.bin
}}}

This process will ask a few questions such as your name and email. It will also display a licence agreement to which you must type "yes". After some time the script will finish and produce output similar to this:
{{{
"The Debian package has been created in the current directory. You can
install the package as root (e.g. dpkg -i blackdown-j2re1.4_1.4.2+02_amd64.deb)."
}}}

Finally, you can install the package as instructed using apt's dpkg:
{{{
$ sudo dpkg -i blackdown-j2re1.4_1.4.2+02_amd64.deb
}}}

== Installing the Mozilla/Firefox plugin ==
Providing the Mozilla/Firefox plugin is available in your distribution of the JRE (currently Sun's doesn't include it), you can create a symbolic link to it inside the Mozilla and Firefox plugins directories. Apparently copying the plugin will not work. The installation directory will vary depending on whethere you installed using method one or two, so both are documented below:
For method one:
{{{
$ sudo ln -sf /usr/local/j2re-1.4.2/plugin/amd64/mozilla/libjavaplugin_oji.so /usr/lib/mozilla-firefox/plugins/libjavaplugin.so
}}}
{{{
$ sudo ln -sf /usr/local/j2re-1.4.2/plugin/amd64/mozilla/libjavaplugin_oji.so /usr/lib/mozilla/plugins/libjavaplugin.so
}}}

Or for method two:
{{{
$ sudo ln -sf /usr/lib/j2re1.4-blackdown/plugin/amd64/mozilla/libjavaplugin_oji.so /usr/lib/mozilla-firefox/plugins/libjavaplugin.so
}}}
{{{
$ sudo ln -sf /usr/lib/j2re1.4-blackdown/plugin/amd64/mozilla/libjavaplugin_oji.so /usr/lib/mozilla/plugins/libjavaplugin.so
}}}

== Manually install the latest Java Update (Only if the previous instructions failed) (not for amd64) ==

The latest version of the Java 2 Platform Standard Edition is JRE 5.0 Update 4

Download
http://java.sun.com/j2se/1.5.0/download.jsp

Choose the "JRE 5.0 Update 4 includes the JVM technology" version

Linux installation instruction
http://java.sun.com/j2se/1.5.0/jre/install-linux.html

Or In A Nutshell

{{{
$ su -
# cd /usr/java
# cp <get.the.latest.java.rpm.bin> java.rpm.bin
# chmod 744 java.rpm.bin
# ./java.rpm.bin
say "yes" to licence

# cd /path/to/firefox/plugins (ie /usr/lib/firefox-1.0.6/plugins)
# ln -s /usr/java/jre1.5.0_04/plugin/i386/ns7/libjavaplugin_oji.so
}}}

== PPC ==
= JavaPPC =

##language:en

Due to Non-Free status of most Java implementations, Ubuntu does not
include Java support natively. See RestrictedFormats.

There are two places to get Java for Ubuntu PPC: IBM and Blackdown.

There was a Talk Page at ["JavaPPC/Talk"].

=== IBM ===

IBM produces a Java Development Kit (JDK) for its POWER computers, which
happens to also work on PPC. They are the only place to make available
recent versions of Java for PPC Linux. Their recent versions consist of versions 1.5.0 and 1.4.2 of Java. They also have a 1.3.1 version, but there is no reason to use that. This page will not discuss the use of IBM's 1.3.1 version.

The 1.4.2 JDK is known to work on G3, G4, and G5 Macs, as well as older 604e and 603e Macs. The 1.5.0 JDK is known to work on G3, G4, and G5 Macs, and it is not yet known whether it works on older 604e and 603e Macs. It is not yet known whether either one works on non-Mac PowerPCs. Please update the Wiki if you have more information!

To get IBM's JDK, go to
http://www-128.ibm.com/developerworks/java/jdk/linux/download.html, and choose an SDK for 32-bit iSeries/pSeries. Be sure to get the 32-bit version even if you have a G5. You may choose to download both the latest 1.5.0 and 1.4.2 versions and install both if you wish. In any case, periodically check that page for newer Service Releases, and repeat the process described here whenever there is a new one. There is currently no way to keep track of which Service Release you are on under Ubuntu, so make a note of it. As of this writing, SR1 is the latest of the 1.5.0, and SR5 is the latest of the 1.4.2 version. You will have to register before being allowed to download anything. When you reach the download page, download the TGZ version of the SDK.



==== Installation Process ====



To use the TGZ with Ubuntu, you have to convert it to a DEB. Make sure you
have the tool `make-jpkg` installed from the Multiverse repository (See ["AddingRepositoriesHowto"]):

{{{
 sudo apt-get install java-package
}}}

If you are still using Breezy Badger, you will now need to upgrade the version of the package you just installed. To do this, download [http://archive.ubuntu.com/ubuntu/pool/multiverse/j/java-package/java-package_0.27_all.deb this file] to your desktop and type:

{{{
 cd ~/Desktop
 sudo dpkg -i java-package_0.27_all.deb
}}}

Now convert the 1.4.2 TGZ and install the resulting DEB:

{{{
 make-jpkg IBMJava2-SDK-142.ppc.tgz
 sudo dpkg -i ibm-j2sdk1.4_1.4.2_powerpc.deb
}}}

Now convert the 1.5.0 TGZ and install the resulting DEB:

{{{
 make-jpkg ibm-java2-sdk-50-linux-ppc.tgz
 sudo dpkg -i ibm-j2sdk1.5_1.5.0_powerpc.deb
}}}

'''Note on libraries:''' the IBM Java binaries depend on libstdc++5 and libgtk1.2 packages. At least in Dapper it's possible that these libraries are not installed. In this case, make-jpkg will give a lot of warnings about not being able to find dependecies for library files. To get the dependencies set correctly (and to get the Java to work at all), make sure you have installed libstdc++5 and libgtk1.2 ''before'' issuing the make-jpkg command.

To set the new JRE or JDK as the default, you may need to update your Java alternatives. Run the following command then, when prompted, choose your preferred Java environment from the list. If update-alternatives tells you that there is only one Java environment, continue onward! If you chose to install both 1.4.2 and 1.5.0 versions, you may run this command at any time to switch the one subsequently opened Java applications will use. The one that the Firefox and Opera web browsers use will be unaffected. Which one the Konqueror web browser uses, and whether or not it would be affected, depends on your KDE system settings.

{{{
 sudo update-alternatives --config java
}}}

If you installed a 1.4.2 version, regardless of whether or not you installed a 1.5.0 version, and your processor is not a G5, you must perform yet another step to get it to work. For a G3 or G4, use the following command:

{{{
 sudo sh -c 'echo "JITC_PROCESSOR_TYPE=6" >> /etc/environment'
}}}

For a 604e or 603e, instead use:

{{{
 sudo sh -c 'echo "JITC_PROCESSOR_TYPE=5" >> /etc/environment'
}}}

You may have to log out or restart the computer for this to take effect.

'''IF''' you installed the JDK, the following code tests that everything's working. Open a terminal, and try this for version 1.4.2:

{{{
 cd /usr/lib/j2sdk1.4-ibm/demo/applets/TicTacToe
 ../../../bin/appletviewer example1.html
}}}

To try version 1.5.0:

{{{
 cd /usr/lib/j2sdk1.5-ibm/demo/applets/TicTacToe
 ../../../bin/appletviewer example1.html
}}}

If you see a Tic Tac Toe game, it worked! If you installed the JRE, you don't have an appletviewer or any demos so try whichever program it was that led you to install java in the first place!

Neither the Firefox web browser nor the full Mozilla suite can use version 1.4.2, but they can use 1.5.0 if you configure as follows:

{{{
 mkdir -p ~/.mozilla/plugins
 cd ~/.mozilla/plugins
 ln -s /usr/lib/j2sdk1.5-ibm/jre/bin/libjavaplugin_oji.so
}}}

To control which Java the Konqueror web browser uses, go to your KDE system settings. Select '''Internet & Network -> Web Browser -> Java & JavaScript''', and change the '''Path to Java executable''' to either '''/usr/lib/j2sdk1.4-ibm/bin/java''' or '''/usr/lib/j2sdk1.5-ibm/bin/java'''. To control which Java the Opera web browser uses, go to '''Tools -> Preferences -> Advanced -> Content -> Java options''', and change the path to either '''/usr/lib/j2sdk1.4-ibm/jre/bin''' or '''/usr/lib/j2sdk1.5-ibm/jre/bin'''.

Test the installation at the Sun Java [http://www.java.com/en/download/help/testvm.xml test webpage]. If the gcj webplugin is given preference over the Java plugin you installed, you can disable the gcj plugin by using the instructions below:

{{{
 sudo dpkg -P gcjwebplugin
}}}

'''Known Issues'''

 * Are there still any?

=== Blackdown ===

Blackdown has been porting Java to various platforms for the past few years.
However, their most recent effort for PPC is Java 1.3.1, and their browser
plugin does not work with recent versions of Mozilla or Mozilla-based browsers.

You can download Blackdown Java from
ftp://ftp.tux.org/pub/java/JDK-1.3.1/ppc/FCS-02c/j2sdk-1.3.1-02c-FCS-linux-ppc.bin
----
CategoryDocumentation
CategoryCleanup

## page was renamed from JavaPackageBuild15001
= Installing Sun Java 1.5.0 Update 3 and later on Ubuntu 5.04 (Hoary) =
'''by Markus Kolb <ubuntu-ml -at- tower-net.de>, Dec 26th 2004'''
'''edited by Kmos, December 11 2005'''

If you are running Breezy, you probably want to go here: https://wiki.ubuntu.com/RestrictedFormats#head-e2ebd70ede0e3eb2117ffbd618d2295dd1540dca

The Ubuntu package java-package (from Hoary) does not support the latest Java versions from Sun.
You have to change a few files in your editor. Here it is what you need and what you have to edit.

== Needed packages for Java packagebuild and support ==

First install Ubuntu's packages '''fakeroot''', '''java-package''' and '''java-common'''.
{{{
sudo aptitude install fakeroot java-package java-common
}}}

Note that [[Anchor(makejpkg)]] java-package resides in the multiverse repository, see http://www.ubuntu.com/support/documentation/faq/helpcenterfaq.2004-09-16.3469703387/talkback/1127809506/view for help on adding the multiverse repository to your apt sources.
or http://packages.debian.org/unstable/misc/java-package

Go to http://java.sun.com/j2se/1.5.0/download.jsp and download the self-extracting Linux files (that end in '''.bin''').

== Changes to java-package files ==

'''Skip this step if you're running Ubuntu Hoary (or later).'''

Change to the directory '''/usr/share/java-package/'''.

Look in the file '''sun-j2sdk.sh''' for the part with:
{{{
    "jdk-1_5_0-beta2-linux-i586.bin")
        j2se_version=1.5.0+beta2
        j2se_expected_min_size=122 # 125899 kB
        found=true
        ;;
}}}

Now add between this part and the "esac" following new lines:
{{{
    "jdk-1_5_0_"[0-9][0-9]"-linux-i586.bin")
        j2se_version="1.5.0+r${archive_name:10:2}"
        j2se_expected_min_size=131 #
        found=true
        ;;
}}}


For the Java Runtime Environment you have to edit '''sun-j2re.sh'''.

Go now below the part
{{{
    "j2re-1_5_0-beta2-linux-i586.bin")
        j2se_version=1.5.0+beta2
        j2se_expected_min_size=81 # 83267 kB
        found=true
        ;;
}}}

and add in front of the "esac":
{{{
    "jre-1_5_0_"[0-9][0-9]"-linux-i586.bin")
        j2se_version="1.5.0+r${archive_name:10:2}"
        j2se_expected_min_size=84 #
        found=true
        ;;
}}}

== Package build ==

Please do not run the package build with real root rights because the Sun installer would install some not necessary files with absolute file paths in your system without package builder control!

{{{
fakeroot make-jpkg --full-name "<Your name>" --email "<Your email>" jdk-1_5_0_06-linux-i586.bin
}}}
(If you got "make-jpkg: command not found", you forgot to install [#makejpkg java-package])
or

{{{
fakeroot make-jpkg --full-name "<Your name>" --email "<Your email>" jre-1_5_0_06-linux-i586.bin
}}}

and follow the instructions on screen.

'''Note: the build may fail with this error:'''
{{{
Loading plugins: blackdown-j2re.sh blackdown-j2sdk.sh common.sh ibm-j2re.sh ibm-j2sdk.sh j2re.sh j2sdk.sh j2se.sh sun-j2re.sh sun-j2sdk.sh

No matching plugin was found.
Removing temporary directory: done
}}}
This is due to a bug in '''dpkg-architecture''' on newer systems. Run '''dpkg-architecture''' and find the line similar to:
{{{
DEB_BUILD_GNU_TYPE=i486-linux-gnu
}}}
Next, run '''sudoedit /usr/share/java-package/sun-j2sdk.sh''' (or '''sun-j2re.sh''') and change line 6 from '''i386-linux''' to your architecture (most commonly '''i486-linux-gnu''').

== Package installation ==

The Debian/Ubuntu package has been created in the current directory. You can
install the package as root (e.g. '''sudo dpkg -i sun-j2sdk1.5_1.5.0+update06_i386.deb''').

To configure java to use the newly installed package, you should configure the java alternative :
'''sudo update-alternatives --config java'''

To confirm you successfully installed it, you can merely type in '''java -version''' in the command prompt.

----
'''Reinhard Tartler''' says:

An updated version of java-package is now available in breezy universe. It allows to build debs for newest JDKs.

---
'''Daniel T Chen''' September 1 2005 :

Using Breezy's current java-package to create an IBM Java2 (1.4.2) JDK deb successfully symlinks the appropriate Web browser plugin but does not install the necessary dependencies, which are libxp6 and libgtk1.2. Please install these two additional packages if you plan to use an IBM Java2 JDK on Breezy.

CategoryDocumentation CategoryCleanup

## page was renamed from NewJava
||<tablestyle="float:right; font-size: 0.9em; width:40%; background:#F1F1ED; margin: 0 0 1em 1em;" style="padding:0.5em;">'''Contents'''[[BR]][[TableOfContents]]||

= java-package =
Java-package contains the tool of choice for installing non-free releases of Java on Ubuntu. `make-jpkg` will convert the Java installers from Sun, IBM, and the Blackdown Project into .deb packages you can manipulate with the standard package management tools. Using package management to control your various Java installations has several advantages, not the least of which is browser plugin control.

== What is apt pinning ==

== Why pin java-package ==
New Java releases can often require a java-package later than the one available in a stable operating system. For example, as of this writing the java-package in Ubuntu 5.04 cannot cope with any Sun releases later than Update 2, and the one in Ubuntu 5.10 does not handle IBM's version 5.

Since stable releases probably won't provide a newer java-package as quickly as you might like, you will need to get it yourself. Using apt pinning to lock java-package to the latest version available will make this painless and transparent.

And finally, since java-package has simple dependencies and nothing else depends upon it, pinning is very straightforward and robust.

= How to Pin java-package =

attachment:IconsPage/IconDialog-Warning1.png If the following does not make complete sense to you, go [#explanation here] first!


== apt-key ==
confirm debian as a secure source
{{{
gpg --keyserver wwwkeys.eu.pgp.net --recv-keys 2D230C5F
gpg --armor --export 2D230C5F | sudo apt-key add -
}}}

== sources.list ==
add debian contrib as a repository
{{{
deb ftp://ftp.us.debian.org/debian/ unstable contrib
}}}

== preferences ==
only debian package that can ever be installed is java-package, and it will upgrade properly
{{{
Package *
Pin: release o=Debian
Pin-Priority: -10

Package: java-package
Pin: release o=Debian
Pin-Priority: 999
}}}

to activate debian contrib
{{{
sudo apt-get update
}}}
to check
{{{
apt-cache policy java-package
}}}
to install
{{{
sudo apt-get install java-package
}}}

attachment:IconsPage/IconNote.png As you can see, pinning a package from a particular repository is quite easy. You might want to consider using pinning with any package you get from a non-Ubuntu source.

= Build custom Java Package =

== Select best release ==
[https://launchpad.net/malone/distros/ubuntu?field.searchtext=java-package&search=Search&orderby=-priority%2C-severity Ubuntu bugs]

For example, the following shows that the bug on ppc plugins is fixed, and is waiting to be uploaded.
http://packages.qa.debian.org/j/java-package.html

selection chart:

||'''Type'''||'''plugin'''||'''download'''||'''Release'''||'''Deb'''||
||'''i386'''||working||[http://java.sun.com/j2se/1.5.0/download.jsp Sun JRE 5.0 Update 6] || jre-1_5_0_06-linux-i586.bin||sun-j2re1.5_1.5.0+update06_i386.deb||
||'''ppc'''||[http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=343837 bug #343837] || [https://www6.software.ibm.com/dl/lxdk/lxdk-p IBM SDK for 32-bit iSeries/pSeries]||ibm-java2-sdk-50-linux-ppc.tgz|| ||
||'''amd64'''||working||http://www.blackdown.org||j2re-1.4.2-02-linux-i586.bin|| ||

== build & install package ==
{{{
sudo apt-get install java-common
fakeroot make-jpkg Release
sudo dpkg -i Deb
}}}
== work-arounds ==
ppc: bug #343837
{{{
? ln -s /usr/lib/j2sdk1.5-ibm/jre/bin/libjavaplugin_oji.so /usr/lib/mozilla-firefox/plugins ?
}}}
[[Anchor(update-alternatives)]]
== Select Operative Java ==
{{{
sudo update-alternatives --config java
}}}

[[Anchor(explanation)]]
= Explanation =
See PinningHowto for background information.
----
CategoryNeedsExpansion

= Firefox 1.5, Flash and Java in amd64 Ubuntu Breezy installations =

{i} This is currently working in Dapper 6.06 rather well.

== You can run Flash and Java plugins in AMD64 bit computers with Firefox, just follow these easy steps : ==


What we are going to do is install 'Firefox 1.5 32 bit version', using linux32 execution command. (Without the complicated 'chroot' method)
 

With this method you can't use the original 'Firefox' from Ubuntu and this new installation at the same time, but it doesn't matter because you won't use the default navigator anymore ;) , for this reason is a good idea print this manual and shut down Firefox browser.


'''1 - Install suport for 32 bit applications :'''


 sudo apt-get install ia32-libs ia32-libs-gtk linux32

 
'''2 - Download firefox 32 bit version from www.getfirefox.com'''


 http://www.mozilla.com/products/download.html?product=firefox-1.5&os=linux&lang=en-US

   
 (Another kind of installation is in FirefoxNewVersion which however differs in some details (installs into /opt; replaces regular /usr/bin/firefox with a new command), but I never tested :S )


'''3 - Untar the downloaded file like you allways do in Ubuntu, and go inside the directory :'''


 cd ~/Desktop/firefox

 ''(or go where the uncompressed file is)''


'''4 - Create a folder for the 32 bit firefox installation, and copy firefox there : '''


 mkdir /usr/local/firefox32

 cp -r -p ./* /usr/local/firefox32/


'''5 - Create the execution files for 32 bit firefox :'''


  sudo gedit /etc/pango32/pangorc &


 Next add this text to the file :

  [Pango]

  ModuleFiles=/etc/pango32/pango.modules

  [PangoX]

  AliasFiles=/etc/pango/pangox.aliases


 Then create another file :


  sudo gedit /usr/local/bin/firefox32 &


 Next add this text to the file :

  #!/bin/sh

  export GTK_PATH=/usr/lib32/gtk-2.0

  export PANGO_RC_FILE=/etc/pango32/pangorc

  linux32 /usr/local/firefox32/firefox $@



'''6 - Make it executable :'''


 sudo chmod +x /usr/local/bin/firefox32


'''7 - Check if your new 32 bit firefox is working :'''


 firefox32 &

 ''(it says warnings but doesn't matter)''


'''8 - To install flash, download linux 32 bit flash player from ''macromedia'' and untar it :'''


 http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash


'''9 - Install flash player :'''


 sudo bash

 apt-get install gsfonts

 apt-get install gsfonts-x11

 cd ~/Desktop/

 linux32 ./install_flash_player_7_linux/flashplayer-installer

 ''(When the installer asks you for the 'navigator path', write : /usr/local/firefox32/)''


'''10 - Check if your new Firefox is working with flash, restart the browser and visit : http://www.macromedia.com'''


 firefox32 &


'''11 - To install Java player to run applets, go to http://www.java.com, and download the linux self stracting file for 32 bit linux computers (I was surprised to see than this file works in amd64 bits Breezy installation) :'''


 http://www.java.com/en/download/linux_manual.jsp


'''12 - To install java :'''


 sudo bash

 chmod 777 ./jre-1_5_0_06-linux-i586.bin

 ''(this file name will depend on the java version you download)''


 ./jre-1_5_0_06-linux-i586.bin

 ''(it will ask you some questions)''


 mkdir /usr/local/java32

 cp -r -p ./jre1.5.0_06/* /usr/local/java32

 cd /usr/local/firefox32/plugins/

 ln -s /usr/local/java32/plugin/i386/ns7/libjavaplugin_oji.so ./


'''13 - Restart firefox32 and check if java is working :'''


 firefox32 &


'''14 - Visit : http://www.java.com/en/download/installed.jsp'''


'''15 - Add an icon at the top panel to start this 'cool' browser :'''

 Click with the right button at the top panel

 Choose : Add to panel

 Choose : Custom application launcher, and press 'Add' button

 
  Name : firefox32

  Generic name : Firefox 1.5 32 bits

  Comment : Firefox with 'Flash' and 'Java'

  Command : firefox32

  Type : Application

  Icon : /usr/share/pixmaps/mozilla-firefox.png



'''16 - Enjoy the net !'''


IMPORTANT NOTE:

 PhilOSparta said in 'Ubuntu forums' that sound was not working properly for him. He solved the problem using the next line (Ubuntu Dapper with gstreamer0.10 will have this issue solved) :


 sudo ln -s /usr/lib/libesd.so.0 /usr/lib/libesd.so.1


Thanks for your attention, kisses


Albert Palacios

=== Adding RealPlayer Support ===

Thanks to the above help, I was also able to get my dearly loved BBC news via the
following technique:

===== Download RealPlayer10GOLD.bin from Real =====

[http://www.real.com/realcom/R?href=http%3A%2F%2Fforms.real.com%2Freal%2Fplayer%2Fdownload.html%3Ff%3Dunix%2FRealPlayer10GOLD.bin%26product%3Dplayerplus%26system%3Dlinux%26pcode%3Drn%26opage%3Dlinux%26src%3Drealplayer%2Cplayerplus%2Clinux&pageid=linuxPage&pageregion=offer_button RealPlayer10GOLD.bin]

===== Make the RealPlayer10GOLD.bin binary executable =====
{{{cd ~/Desktop
chmod a+x RealPlayer10GOLD.bin}}}

===== Install using linux32 =====
{{{sudo linux32 ./RealPlayer10GOLD.bin
}}}

Follow the instructions as indicated. Install to /usr/local/realplayer32/ for consistency sake.

===== Copy relevant plugins to your Firefox 32bit directory =====
{{{cd /usr/local/realplayer32/mozilla/
sudo cp * /usr/local/firefox32/plugins}}}

===== Test =====
Shutdown all instances of Firefox and restart your firefox32 as per above. Go to www.bbc.com and try the listen live radio portions to test.

Good luck.

----

This tutorial has been modified, these are some notes from the tutorial before last changes (which hopefully solved these problems)

        ''If you are having problems with segmentation faults when trying to use the browser's or email client's "Open" or "Execute" methods for opening data files or attachments in helper applications (such as 'evince' for PDFs), then try this alternative method:


Change the files 'firefox32' and 'thunderbird32' to read''

''#!/bin/sh''

''export GTK_PATH=/usr/lib32/gtk-2.0''

''export LD_PRELOAD=/usr/lib32/libpangohack.so.0''

''linux32 /usr/local/<firefox/thunderbird>32/<firefox/thunderbird> $@''


        ''Note that this method is untested AFAIK - please post any potential issues with it. Many thanks to 'lychee' from the forums.


DrBob: just 2 comments

 * sound is an issue under KDE (Kubuntu) as well. The arts daemon (if running) must be suspended in order for Flash to be able to emit sound.
 * with the above procedure, the fonts used by firefox32 don't match those in the ubuntu-packaged version. I don't know how to fix this (those that
 appear in firefox32 are oversized for me, YMMV). NB. I'm talking about the fonts used in the GUI, not those used in rendering webpages (but the latter
 don't quite match either).''

------

Discuss this page at http://ubuntuforums.org/showthread.php?p=626612

------

CategoryDocumentation CategoryCleanup

------


== Other stuff ==
This page has instructions for setting up Java for an Advanced Placement Computer Science course on Ubuntu 5.10 ("Breezy"), and by extension, on the first release of Edubuntu.

'''Note:''' If you need the Sun JDK see RestrictedFormats or JavaPackageBuildNewVersions.
The instructions below will install Blackdown Java which may not be what you want.

There are many different ways to setup Java, and this document will *not* try to survey them. Instead, an attempt will be
made to identify the easiest, most straight forward way to get Java configured for an AP CSC course. Instructions assume
a default installation of Ubuntu 5.10 to start and an account with administrative previledges.

== Configure apt repositories ==

  0. On the top panel, select `System -> Administration -> Update Manager` and type your password (assuming you have administrative priviledges.
  0. Click the `Preferences` button in the lower left hand corner of the Software Updates window.
  0. Remove all Software Sources, then 'Add' each of the respositories available in the drop-down menu ("Breezy Badger", Security Updates, and Updates) with all four components (Officially supported, Restricted copyright, Community maintained (Universe), and Non-free (Multiverse)) selected.
  0. Start the synaptic package manager (`System -> Administration -> Synaptic Package Manager`)
  0. Click the reload button to update the package list.
  0. Click the `Search` button, and type `j2sdk` into the search field.
  0. Install the `j2sdk1.4` package (note: this will also install the `j2jre1.4` package).

== Installing and Using `ap.jar` Package ==

  0. Visit http://www.ibiblio.org/obp/classpath/ap/ and download the `ap.jar` file.
  0. Copy (or move) `ap.jar` to `/usr/lib/j2se/1.4/jre/lib/ext`.

----
CategoryDocumentation CategoryCleanup
#REFRESH 0 http://help.ubuntu.com/community/Java

Java (last edited 2008-08-06 16:24:58 by localhost)