Java and linux ubuntu

Java

This plugin works with the browsers: Epiphany, Firefox and Opera.

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

OpenJDK v6 & v7 SDK (Software Development Kit)

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

Alternative Virtual Machines

  • JamVM: This is the default VM for ARM in 11.10. Install the icedtea-6-jre-jamvm package if available. If it is not, then compile instructions can be found here.
  • Cacao: Ensure the icedtea-6-jre-cacao package is installed.
  • Zero/Shark: Shark is a just-in-time (JIT) compiler for Zero. Install the openjdk-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 equivalent) and the other documents in that directory for more information. Note, the IcedTea browser plugin will use the default VM (which you can change in the file /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 binaries (without installer) can be downloaded directly from Oracle (Oracle Java download page).

Installing Oracle Java 7 by a script or from the command line

You can install the newest and secure Oracle Java 7 by a script (JRE only) or by a command line method. Both are easy to apply.

Script (JRE only)

Command line methods

  • Using webupd8.org’s strikingly simple method.
  • How do I install Oracle JRE 7?
  • http://sites.google.com/site/easylinuxtipsproject/java (for JRE, more extensive 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 updated as Oracle releases Java updates, which means that there will be no need to keep track of updates and reinstall them manually.

A note (hopefully temporary) about the Eugene San PPA for those who are attempting 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 apt-get purge oracle-java7-installer* sudo apt-get install ppa-purge sudo ppa-purge ppa:eugenesan/java sudo apt-get clean sudo 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 files immediately and permanently from an important directory. Be extremely cautious.

sudo rm /var/lib/dpkg/info/oracle-java7-installer* sudo apt-get purge oracle-java7-installer* sudo rm /etc/apt/sources.list.d/*java* sudo apt-get update

There is also an RFE opened on Oracle bugtracker to provide the debian package/installer for Java 7. Please consider voting for this RFE.

Oracle Java 8

Oracle has declared Java 8 to be fit for general use. Currently there are no .deb packages available for Oracle Java 8. The raw binaries (without installer) can be downloaded directly from Oracle (Oracle Java download page)

Command line installation methods

OpenJDK Java 8

Build it yourself

It’s actually also easy to build the Java 8 yourself directly from sources. Sounds scary? It really is surprisingly easy, and seriously literally takes about 15 minutes, using hgomez/obuildfactory, as described on vorburger.ch blog post.

OpenJDK Java 9

Build it yourself

Once you have a Java 8 bootstrap JDK, either from the binary Oracle package or one of the PPAs or one you built yourself, it’s then easy to build OpenJDK Java 9 yourself. Use the same as above, but make sure that you set the JDK_HOME and PATH to point to your Java 8 JDK, which is needed to build Java 9.

Choosing the default Java to use

If your system has more than one version of Java, configure which one your system 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 PowerPC. 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 supposedly also configures your system. You can use either, both require additional configuration with Ubuntu. The ‘Installable’ package also provides an uninstall 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 options. Extract the file to the directory of your choice (for example /usr/lib/jvm/java-6-ibm-powerpc).

Once completed, you then need to tell the system where to find the new java commands. If you only have IBM Java installed then you can define an environment variable to do this. For example, add the following line to your .bashrc file in your 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 alternatives:

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/java-6-ibm-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 you can use:

sudo update-alternatives --install /usr/lib/mozilla/plugins/mozilla-javaplugin.so 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 way to link the plugin).

If you don’t use the mozilla plugin frequently then you can disable it for security. You can do this through the Firefox menus or there are Firefox extensions you can use to automate this.

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/jvm/java-6-ibm-powerpc/bin/java or java (without any quotes).

Test the installation at the Sun Java test webpage and using the command:

Note, there are old PowerPC deb packages still in medibuntu (keep clicking refresh if you get 403 forbidden). These are probably the easiest way to install, although 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 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 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. 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.

Java (последним исправлял пользователь 208 2015-07-24 22:21:28)

The material on this wiki is available under a free license, see Copyright / License for details
You can contribute to this wiki, see Wiki Guide for details

Источник

Install the Java Runtime Environment

The Java Runtime Environment (JRE) is required to run Java programs. Nowadays there are many JRE packages available from a variety of projects and companies, but the two most popular on Ubuntu are OpenJDK and Oracle HotSpot. Using one package over the other should not create any functional difference in most applications; however, some prefer OpenJDK over Oracle HotSpot as the former does not contain closed-source components, has a much clearer licensing and support policy, and is maintained as part of the Ubuntu archive, with easier installation and upgrades.

In this guide, we’ll be going through the installation of both JRE packages. Of course, you generally only need to pick the one that best suits your needs and preferences.

What you’ll learn

What you’ll need

That’s all you need. If you have that, let’s proceed to the next step!

2. Installing OpenJDK JRE

With new versions of Java released every 6 months, there are multiple versions available for use. Nowadays, Java 11 is the current Long Term Support (LTS) version, but Java 8 is still widely used. Moreover, the non LTS versions of Java are bringing a steady stream of innovation into the language, and also see some adoption.

Ubuntu offers the default-jre package, which is regularly updated to ship the latest version of the current OpenJDK JRE in Long Term Support (LTS). The default-jre is an excellent choice for most situations, thanks to the outstanding track of backwards compatibility of the Java Virtual Machine.

(Alternatively, you may opt to use a specific Java version, using for example the openjdk-11-jre package; as updates are released for that version of the Java Virtual Machine, that packages will be updated, allowing you to stick to the latest and greatest update of one specific version of the Java language.)

To install the OpenJDK JRE, we run:

sudo apt install default-jre 

We can check if OpenJDK JRE was properly installed by running:

It should output the following:

openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2) OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2, mixed mode) 

(Although the output may change in the future as new Java versions are promoted to LTS status, or the current LTS version receives updates.)

In the next step we’ll install Oracle HotSpot JRE.

3. Installing Oracle HotSpot JRE

Downloading the Oracle HotSpot JRE binaries

Download JRE binaries in .tar.gz (tarball) by heading over to their website. An Oracle account is needed to download the Oracle HotSpot JRE.

Oracle does not currently offer JRE packages for Java 11 or above from their website so, for this tutorial, we will use the Oracle HotSpot JRE version to be 8u291 (Java 8, update 291).

Installing

Create a directory to install JRE in with:

Move the JRE binaries into the directory:

sudo mv jre-8u291-linux-x64.tar.gz /usr/local/java 

Go into the install directory:

sudo tar zxvf jre-8u291-linux-x64.tar.gz 

Post-installation steps

To save space, delete the tarball by running:

sudo rm jre-8u291-linux-x64.tar.gz 

Let the system know where JRE is installed:

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jre1.8.0_291/bin/java" 1 

After that’s done, check the installation by running:

It should output the following:

java version "1.8.0_291" Java(TM) SE Runtime Environment (build 1.8.0_291-b10) Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode) 

Need further assistance?

Источник

Читайте также:  Драйвера mercusys для linux
Оцените статью
Adblock
detector