Vous êtes sur la page 1sur 7

Partners Support Community Ubuntu.

com Ubuntu Documentation Official Documentation Community Help Wiki Login to edit Java Contents Introduction OpenJDK Installation of Java Runtime Environment Browser plugin SDK (Software Development Kit) Alternative Virtual Machines Oracle Java 7 Installing Oracle Java 7 by a script or from the command line Script (JRE only) Command line methods Oracle (Sun) Java 6 JDK or JRE Manual method Choosing the default Java to use IBM Java GNU Compiler for Java External link Introduction Java is a technology from Oracle (formerly: Sun Microsystems). There are several implementations, of which five will be discussed here: OpenJDK: The primary goal of the OpenJDK project is to produce an open-sourc e implementation of the Java SE Platform (6 and 7). This is the default version of Java that Ubuntu uses and is the easiest to install. Oracle (Sun) Java 6: Oracle (Sun) Java 6 is the reference implementation for Java 6. Oracle Java 7: Oracle Java 7 is Oracle's own version of Java 7. IBM Java: IBM Java is the preferred Java solution on PowerPC machines. It is a reimplementation of Java with a Just-In-Time Compiler. It is only available f rom IBM's website. GNU Compiler: A Java compiler made by GNU. Only developers should have to in stall this. OpenJDK Installation of Java Runtime Environment

Install the openjdk-6-jre package using any installation method. Install the openjdk-7-jre package using any installation method. Browser plugin Install the icedtea6-plugin package using any installation method. Install the icedtea-7-plugin package using any installation method. This plugin works with the main browsers: Firefox, Chromium, Google Chrome, and Epiphany. On Konqueror, go to Settings Configure Konqueror... and from menu select Java & JavaScript, then tick Enable Java globally option. SDK (Software Development Kit) In Java parlance the Java Development Kit (JDK) is sometimes used for SDK. (More about that here.) Install the openjdk-6-jdk package using any installation method. Install the openjdk-7-jdk package using any installation method. Alternative Virtual Machines Most users won't need to worry about these, but if you use an architecture (e.g. PowerPC) that defaults to the Zero Virtual Machine (VM), then you may see a sig nificant performance increase if you switch to: JamVM: This is the default VM for ARM in 11.10. Install the icedtea-6-jre-ja mvm package if available. If it is not, then compile instructions can be found h ere. Cacao: Ensure the icedtea-6-jre-cacao package is installed. Zero/Shark: Shark is a just-in-time (JIT) compiler for Zero. Install the ope njdk-6-jre-zero package if available. On architectures which use the Zero VM as the default, the openjdk-6-jre-zero package contains the Shark VM. To use a different VM other than the default, just add the appropriate option to the command you normally use. For example: java -jamvm|-cacao|-shark|-zero -version See the file /usr/lib/jvm/java-6-openjdk-powerpc/docs/README.Debian (or its equi valent) and the other documents in that directory for more information. Note, th e IcedTea browser plugin will use the default VM (which you can change in the fi le /etc/java-6-openjdk/jvm.cfg). Oracle Java 7 Oracle has declared Java 7 to be fit for general use. Currently there are no .deb packages available for Oracle Java 7. The raw binari es (without installer) can be downloaded directly from Oracle (Oracle Java downl oad page).

Installing Oracle Java 7 by a script or from the command line You can install the newest and secure Oracle (Sun) Java 7 by a script (JRE only) or by a command line method. Both are easy to apply. Script (JRE only) Only supports Oracle (Sun) Java 7 JRE (which covers the needs of 99 % of all com puter users). It pulls the packages from Oracle's website and installs them, com parable to the way Adobe Flash Player is being installed. Plus it adds a dedicat ed repository, from which you'll receive updates automatically. http://www.duinsoft.nl/packages.php?t=en Command line methods Do-it-yourself methods, but very easy to apply (basically: you copy/paste some t erminal commands). Using webupd8.org's strikingly simple method. How do I install Oracle JRE 7? http://sites.google.com/site/easylinuxtipsproject/java (for JRE, more extens ive explanation of the commands than in askubuntu.com) How do I install Oracle JDK 7? Create a local apt Java repository Using webupd8.org's method has a great benefit in that the package will be updat ed as Oracle releases Java updates, which means that there will be no need to ke ep track of updates and reinstall them manually. A note (hopefully temporary) about the Eugene San PPA for those who are attempti ng to use it and are having issues: As of the time of this entry, the eugenesan/ java PPA is broken. If you have attempted to use it, you may do the following to remove it and use webupd8.org's PPA method (above) instead sudo sudo sudo sudo sudo apt-get purge oracle-java7-installer* apt-get install ppa-purge ppa-purge ppa:eugenesan/java apt-get clean apt-get update

If the preceding does not work, you may try the following more aggressive method . Be aware, however, that it uses the rm command, which will completely remove f iles immediately and permanently from an important directory. Be extremely cauti ous. sudo sudo sudo sudo rm /var/lib/dpkg/info/oracle-java7-installer* apt-get purge oracle-java7-installer* rm /etc/apt/sources.list.d/*java* apt-get update

There is also an RFE opened on Oracle bugtracker to provide the debian package/i nstaller for Java 7. Please consider voting for this RFE. Oracle (Sun) Java 6

WARNING: Oracle Java 6 had reached its end of life in November 2012. There is at least one severe known vulnerability in this version, and since Java 6 is neith er supported by Canonical nor Oracle, there may be many more! You should really not install this unless you have a specific need to do so. It is recommended tha t users either migrate to OpenJDK, or install Oracle Java 7. Oracle (Sun) Java 6 is no longer available to be distributed by Ubuntu, because of license issues. Deprecated information about the installation of Oracle Java 6: JDK or JRE Downloads the Java binary installers from Oracle, builds the .deb packages local ly on your computer and then installs them. Packages are compatible with the offi cial Ubuntu ones and will upgrade Java 6 that was previously installed from packa ges. You can find the script and full usage instructions on github. https://github.com/flexiondotorg/oab-java6 (since version 0.2.3 it also works with java 7 using -7 optional parameter). Another instruction it works for Ubuntu 12.04. http://superuser.com/questions/353983/how-do-i-install-the-sun-java-sdk-in-u buntu-11-10-oneric Manual method oracle java 6 jre 32-bit $ wget http://download.oracle.com/otn-pub/java/jdk/6u34-b04/jre-6u34-linux-i586 .bin $ chmod u+x jre-6u34-linux-i586.bin $ ./jre-6u34-linux-i586.bin $ sudo mkdir -p /usr/lib/jvm $ sudo mv jre1.6.0_34 /usr/lib/jvm/ $ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jre1. 6.0_34/bin/java" 1 $ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so " "mozilla-javaplugin.so" "/usr/lib/jvm/jre1.6.0_34/lib/i386/libnpjp2.so" 1 $ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/j re1.6.0_34/bin/javaws" 1 or oracle java 6 jdk 64-bit $ wget --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F" h ttp://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin $ chmod u+x jdk-6u45-linux-x64.bin $ ./jdk-6u45-linux-x64.bin $ sudo mv jdk1.6.0_45 /opt $ sudo update-alternatives --install "/usr/bin/java" "java" "/opt/jdk1.6.0_45/b in/java" 1 $ sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/jdk1.6.0_45 /bin/javac" 1 $ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so

" "mozilla-javaplugin.so" "/opt/jdk1.6.0_45/jre/lib/amd64/libnpjp2.so" 1 $ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/opt/jdk1.6.0_ 45/bin/javaws" 1 IMPORTANT choose the java you installed as default $ sudo update-alternatives --config java $ sudo update-alternatives --config javac Optionally you can set a JAVA_HOME env variable: export _JAVA_HOME=/opt/jdk1.6.0_45/ Choosing the default Java to use If your system has more than one version of Java, configure which one your syste m uses by entering the following command in a terminal window sudo update-alternatives --config java This will present you with a selection that looks similar to the following (the details may differ for you): There are 2 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status * 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode 1 /usr/lib/jvm/jre1.7.0/jre/bin/java 3 manual mode Press enter to keep the current choice[*], or type selection number: 1 IBM Java IBM provide JRE and SDK binaries for a number of architectures, including PowerP C. These are available via the IBM Downloads Page once you have registered. There are two types of 'InstallAnywhere' package available to you: the 'Archive/ tgz' only extracts the files to your system, whereas the 'Installable' package s upposedly also configures your system. You can use either, both require addition al configuration with Ubuntu. The 'Installable' package also provides an uninsta ll option. To run the downloaded file use the following commands: chmod a+x ibm-java-ppc-jre-6.0-10.1.bin sudo ./ibm-java-ppc-jre-6.0-10.1.bin This launches an interactive program that guides you through the installation op tions. Extract the file to the directory of your choice (for example /usr/lib/jv m/java-6-ibm-powerpc). Once completed, you then need to tell the system where to find the new java comm ands. If you only have IBM Java installed then you can define an environment var iable to do this. For example, add the following line to your .bashrc file in yo ur home directory. export PATH=/usr/lib/jvm/java-6-ibm-powerpc/bin:/usr/lib/jvm/java-6-ibm-powerpc/ jre/bin:$PATH If you also have openjdk installed then you'll need to update the java alternati

ves: sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/java-6-i bm-powerpc/jre/bin/java" 1 sudo update-alternatives --set java /usr/lib/jvm/java-6-ibm-powerpc/jre/bin/java You'll need to repeat this for every command you need. For the mozilla plugin yo u can use: sudo update-alternatives --install /usr/lib/mozilla/plugins/mozilla-javaplugin.s o mozilla-javaplugin.so /usr/lib/jvm/java-6-ibm-powerpc/jre/lib/ppc/libnpjp2.so 1 sudo update-alternatives --config mozilla-javaplugin.so Further guidance can be found in the IBM documentation (including a different wa y to link the plugin). If you don't use the mozilla plugin frequently then you can disable it for secur ity. You can do this through the Firefox menus or there are Firefox extensions y ou can use to automate this. To control which Java the Konqueror web browser uses, go to your KDE system sett ings. Select Internet & Network -> Web Browser -> Java & JavaScript, and change the Path to Java executable to either /usr/lib/jvm/java-6-ibm-powerpc/bin/java o r java (without any quotes). Test the installation at the Sun Java test webpage and using the command: java -version Note, there are old PowerPC deb packages still in medibuntu (keep clicking refre sh if you get 403 forbidden). These are probably the easiest way to install, alt hough they are now lacking security updates, plus the latest browser plugin. For these reasons it is strongly advised that you download a newer Service Refresh Fix Pack directly from the IBM Downloads Page. You may have to install libstdc++5 and libgtk1.2 packages to use old versions of IBM Java. If you installed a 1.4.2 version, and your processor is not a G5, you may have to perform another step to get it to work. For a G3 or G4, use the fol lowing 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 will have to log out or restart the computer for this to take effect. 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. Gcjwebplu gin is a little web browser plugin to execute Java applets.

It is targeted for Mozilla and compatible browsers that support the NPAPI. Other s include the Eclipse Java Compiler, which is maintained by the Eclipse Foundati on. Eclipse is an open-source Integrated development environment (IDE) written p rimarily in Java. The Eclipse open source community has over 60 open source proj ects. OpenJDK is the open source Java, derived from sources which will become Op enJDK 7 in the future. External link Official website of Sun Java Official website of OpenJDK Developper support about Java API for Java 6 IcedTea Browser Plugin CategorySoftware CategoryDocumentation Java (last edited 2013-05-27 13:32:31 by emmanuel-kasper) The material on this wiki is available under a free license, see Copyright / Lic ense for details You can contribute to this wiki, see Wiki Guide for details

Vous aimerez peut-être aussi