Вы находитесь на странице: 1из 5

Java for Linux

To develop Java applications, use Java tools, and run many Java products,
you must install the Java Software Development Kit (SDK) and the Java Runtime
Environment (JRE) on your system. Together, they make up the Java Platform,
Standard Edition (J2SE). Sun/Oracle currently supports and distributes Linux
versions of these products. You can download them from Sun at
java.com/downloads install them on your system.

Developer(s) Oracle Corporation
Initial release May 8, 2007
Written in C++ and Java
Operating
system
Linux, FreeBSD, Mac OS X,
OpenIndiana; several other ports in
progress
Type Java platform
License GNU GPL+linking exception
Website Official website
OpenJDK (Open Java Development Kit) is a free and open source implementation of the Java
Platform, Standard Edition (Java SE). It is the result of an effort Sun Microsystems began in
2006. The implementation is licensed under the GNU General Public License (GNU GPL) with a
linking exception. Were it not for the GPL linking exception, components that linked to the Java
class library would be subject to the terms of the GPL license. OpenJDK is the official Java SE 7
reference implementation.
Components
The OpenJDK project consists of a number of components. Principally these are HotSpot (the
virtual machine), the Java Class Library and the javac Java compiler.
The web browser plugin and Web Start which are part of Oracle Java are not included in
OpenJDK. Sun previously indicated that they would try to open source these components but
neither Sun nor Oracle have done so. The only currently available free plugin and Web Start
implementation are those provided by IcedTea.
Supported JDK versions
OpenJDK was initially based only on the JDK 7 version of the Java platform.
There are several separate OpenJDK projects:
The OpenJDK 8 project, which is the basis for JDK 8, was released on 3/18/2014.
The OpenJDK 7u project, which is based on JDK 7 and produces updates to the existing
Java 7 releases.
The OpenJDK 6 project, which is based on JDK 7, retrofitted to provide an open-source
version of Java 6.
Install Oracle Java JDK/JRE 8u20 on Fedora 20/19,
CentOS/RHEL 7/6.5/5.10
1. Download Sun/Oracle Java JDK/JRE 8u20 32-bit/64-bit RPM packages
Download Sun/Oracle Java 7u55 from here
http://www.oracle.com/technetwork/java/javase/downloads/index.html. Select rpm package
(jdk-8u20-linux-i586.rpm, jdk-8u20-linux-x64.rpm, jre-8u20-linux-i586.rpm or jre-8u20-
linux-x64.rpm).
2. Change to root user.
sudo -i
## OR ##
su -
3. Install Java JDK or JRE package
## JDK 32-bit ##
rpm -Uvh /path/to/binary/jdk-8u20-linux-i586.rpm

## JDK 64-bit ##
rpm -Uvh /path/to/binary/jdk-8u20-linux-x64.rpm

## JRE 32-bit ##
rpm -Uvh /path/to/binary/jre-8u20-linux-i586.rpm

## JRE 64-bit ##
rpm -Uvh /path/to/binary/jre-8u20-linux-x64.rpm
4. Install Sun/Oracle JDK java, javaws and javac with alternatives install command
Use Java JDK latest version (/usr/java/latest)
## java ##
alternatives --install /usr/bin/java java
/usr/java/latest/jre/bin/java 200000
## javaws ##
alternatives --install /usr/bin/javaws javaws
/usr/java/latest/jre/bin/javaws 200000


## Install javac only if you installed JDK (Java Development
Kit) package ##
alternatives --install /usr/bin/javac javac
/usr/java/latest/bin/javac 200000
alternatives --install /usr/bin/jar jar /usr/java/latest/bin/jar
200000

## java ##
alternatives --install /usr/bin/java java
/usr/java/jre1.8.0_20/bin/java 200000

## javaws ##
alternatives --install /usr/bin/javaws javaws
/usr/java/jre1.8.0_20/bin/javaws 200000


Java 8 Console output:

6. Swap between OpenJDK and Sun/Oracle Java JDK/JRE 6, 7 and 8 versions
java
alternatives --config java

There are 4 programs which provide 'java'.

Selection Command
-----------------------------------------------
1 /usr/java/jdk1.6.0_26/jre/bin/java
2 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
3 /usr/java/jdk1.7.0_55/jre/bin/java
*+ 4 /usr/java/jdk1.8.0_20/jre/bin/java

Enter to keep the current selection[+], or type selection
number: 4
Note: java with [+] is currently on use
Post-Installation Setup
Add JAVA_HOME environment variable to /etc/profile file or $HOME/.bash_profile file
Java JDK and JRE latest version (/usr/java/latest)
## export JAVA_HOME JDK/JRE ##
export JAVA_HOME="/usr/java/latest"
Java JDK and JRE absolute version (/usr/java/jdk1.8.0_20)
## export JAVA_HOME JDK ##
export JAVA_HOME="/usr/java/jdk1.8.0_20"

## export JAVA_HOME JRE ##
export JAVA_HOME="/usr/java/jre1.8.0_20"

Install Sun/Oracle JAVA libjavaplugin.so (for Firefox/Mozilla) with alternatives
install command:

## Java Browser (Mozilla) Plugin 32-bit ##
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so
libjavaplugin.so /usr/java/latest/jre/lib/i386/libnpjp2.so
200000

## Java Browser (Mozilla) Plugin 64-bit ##
alternatives --install
/usr/lib64/mozilla/plugins/libjavaplugin.so
libjavaplugin.so.x86_64
/usr/java/latest/jre/lib/amd64/libnpjp2.so 200000

Note: Check libjavaplugin.so with restarting Mozilla Firefox and writing about:plugins on
address bar.



The Java Applications
Numerous additional Java-based products and tools are currently
adaptable for Linux. Tools include Java 3D, Java Media Framework (JMF),
and JAI. Many of the products such as the Java web server run directly as
provided by Sun/Oracle. The Jakarta project (jakarta.apache.org), part of the
Apache Software Foundation, provides open source Java tools and
applications, including libraries, server applications, and engines. Jakarta,
along with other packages, is included with most distributions.

Вам также может понравиться