Воскресенье, 19.05.2024, 14:02
Приветствую Вас Гость | RSS
Мой сайт
Главная
Регистрация
Вход
Форма входа

Меню сайта

Категории раздела
Об ОС Windows [137]
В категории размещаются статьи, касающщиеся операционных систем от Microsoft.
Об ОС *Nix [198]
В данной категории собраны статьи об ОС семейства Unix/Linux/FreeBSD/...
Справочные материалы [351]
Справка по всему разделу.
Виртуализация и Облака [46]
Networks & Routing [86]
DataBases [22]

Наш опрос
Оцените мой сайт
Всего ответов: 209

Статистика

Онлайн всего: 1
Гостей: 1
Пользователей: 0

Главная » Статьи » Системное администрирование » Об ОС *Nix

Ubuntu Java

Introduction

Java is a technology from Sun Microsystems. There are several implementations, of which three will be discussed here:

  • OpenJDK: The primary goal of the OpenJDK project is to produce an open-source implementation of the Java SE 6 Platform.

  • Sun Java: Sun Java is the reference implementation.

  • IBM Java: IBM Java is a reimplementation with a Just-In-Time Compiler. It is only available from IBM's website. It is the preferred Java solution on PowerPC machines.

OpenJDK

Installation of Java Runtime Environment

  • Install the openjdk-6-jre package using any installation method.

Browser plugin

This plugin works with the main browsers: Firefox, Chromium, Google Chrome, Epiphany.

On Konqueror, go to Settings → Configure Konqueror... and from menu select Java & JavaScript, then tick Enable Java globally option.

SDK (Software Development Kit)

  • Install the openjdk-6-jdk package using any installation method.

Sun Java

The Sun Java 6 packages are available from the partner repository. You can configure your system to use this repository via command-line:

sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update

Installation of Java Runtime Environment and its browser plugin

Kubuntu Users may have a problem if they try to install with Kpackagekit. (it may be impossible agree the licence). To complete the installation, please use apt-get.

The browser plugin works with the main browsers:: Firefox, Chromium, Google Chrome, Epiphany. A control panel is also present in System → Preference → Sun Java 6 Plugin Control Panel.

SDK (Software Development Kit)

  • Install the sun-java6-jdk package using any installation method.

At the end of the installation process the application will be present in Application → Programming → Sun Java 6 VisualVM.

Installing Sun Java from the command line

I think this is faster and easier to install from the command line so I wanted to share how to do this.

sudo apt-get install sun-java6-jre sun-java6-bin sun-java6-jdk sun-java6-plugin sun-java6-fonts

Choosing the default Java to use

If your system has more than one version of Java, type the following command in a terminal window:

sudo update-alternatives --config java

to choose the version that you want to use.

GNU Compiler for Java

Install the java-gcj-compat-headless package using any installation method.

To install the development environment, install the java-gcj-compat-dev package using any installation method.

GCJ is a front end to the GCC compiler which can natively compile both Java(tm) source and bytecode files. The compiler can also generate class files. Gcjwebplugin is a little web browser plugin to execute Java applets.

It is targeted for Mozilla and compatible browsers that support the NPAPI. Others include the Eclipse Java Compiler, which is maintained by the Eclipse Foundation. Eclipse is an open-source Integrated development environment (IDE) written primarily in Java. The Eclipse open source community has over 60 open source projects. OpenJDK is the open source Java, derived from sources which will become OpenJDK 7 in the future.

PowerPC

OpenJDK is available on powerpc, in interpreted mode, which is rather slow.

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. Both also work on non-Mac PowerPCs like the EFIKA. 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, SR4 is the latest of the 1.5.0, and SR7 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.

Note: It appears that the IBM Java 5.0 JDK is available with IBM WebSphere Application Server Community Edition from SourceForge for both x86 and PowerPC - http://sourceforge.net/powerbar/websphere/download.php - the download does not require any registration.

Note: There is now an easier way to install the IBM JDK, all you have to do is to add the medibuntu-repository to your sources.list (or in a new file in the sources.list.d-directory if you are on Feisty) - simply replace "feisty" with the distribution you are using, e.g. "edgy" or "dapper":

echo "deb http://packages.medibuntu.org/ feisty free non-free" | sudo tee -a /etc/apt/sources.list

Then run this

wget -q http://packages.medibuntu.org/medibuntu-key.gpg -O- | sudo apt-key add - && sudo apt-get update

After that, you can use Synaptic, Adept or simply apt-get to install the package 'ibm-j2sdk1.5', latest version is still 1.5, no 1.6 yet - that may change with OpenJDK... The JDK will be set the new default by the install and Konqueror automatically detects it, but you may need to read the step regarding Firefox. You can skip the subsequent steps.

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 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: The latest version (as of February 1, 2007) of the IBM 1.5 SDK, SR4, is called ibm-java2-sdk-5.0-4.0-linux-ppc.tgz. When I tried to install it on Edgy, it returned a No matching plugin found. error. I was able to install it successfully by renaming the downloaded file to match the name ibm-java2-sdk-50-linux-ppc.tgz before running the make-jpkg command.

Note on libraries: the IBM Java binaries depend on libstdc++5 and libgtk1.2 packages. In Dapper and later it's possible that these libraries are not installed because they've been replaced by libstdc++6 and libgtk2.0. In this case, make-jpkg will give a lot of warnings about not being able to find dependencies 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 (either by using Synaptic or from the command line) before issuing the make-jpkg command.

To set the new JRE or JDK as the default, you may need to update your Java alternatives. To check your current default, run:

java -version

If you're not happy with what you see, run the following command and, when prompted, choose your preferred Java environment from the list. If update-alternatives tells you that there is only one Java environment, then you'll need to install another version to make a change. 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.

Note: In the GNOME environment of Ubuntu 6.06 LTS/Dapper Drake, it may be possible that changing language selections may overwrite this file, causing a 1.4.2 version of IBM Java to stop working completely. Please share such experiences, if any, on this wiki.

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 test webpage.



Источник: https://help.ubuntu.com/community/Java
Категория: Об ОС *Nix | Добавил: admin (21.10.2011)
Просмотров: 1676 | Комментарии: 3 | Теги: plugin, install, java | Рейтинг: 0.0/0
Всего комментариев: 0
Имя *:
Email *:
Код *:
Поиск

Друзья сайта
  • Официальный блог
  • Сообщество uCoz
  • FAQ по системе
  • Инструкции для uCoz


  • Copyright MyCorp © 2024