From Fedora Project Wiki

No edit summary
 
(43 intermediate revisions by 12 users not shown)
Line 1: Line 1:
= Java on Fedora =
<div class="messagebox" style="float: right; margin-left: 10px;">__TOC__</div>
Java is about:
* Communities: the [https://www.jcp.org/ Java Community Process] to define the platform, but also [https://community.oracle.com/community/java/jug Java User Groups]
* Platforms (JVM, JRE ...) to run applications on PC, mobiles, embedded devices https://en.wikipedia.org/wiki/Java_(software_platform)
* Programming languages (Java is the most popular, but there are Scala, Groovy, Clojure ...) https://en.wikipedia.org/wiki/Java_(programming_language)


Fedora uses a Free software stack that consists of [http://en.wikipedia.org/wiki/Openjdk OpenJDK], GNU Compiler for Java, GNU classpath and the Eclipse Java compiler to implement Java. See our [[JavaFAQ]]  for more information on that.  Note that AOT compilation using GCJ has been deprecated (made optional) and new packages or updated ones will be built with OpenJDK in a regular Java compilation to bytecodes.


Software mentioned on this page may come in different packaging formats. Fedora's own packages (''RPM'') are easy to install (''with Yum'') and installation instructions can be found from [[Docs/Drafts/SoftwareManagementGuide]]. Third party packages may be in archive formats (.zip, tar) and then case specific instructions should be provided.
What do you want to do:
* If you came here because an '''application ask for Java''' (or JRE, JVM) '''to be installed''', then simply install {{package|java-1.8.0-openjdk}}.
* If it still does not work:
** Install javafx and icedtea-web packages as well.
** Lastly, and if the application '''ask specifically for [http://www.oracle.com/technetwork/java/javase/index.html Oracle Java]''': See here [[#Oracle_version]].
* If '''you want to develop, code, on the Java Platform''': See [[Java/Development]].


= Terminology =


In Java context, terms may be a bit confusing for newcomers. '''JRE''' (''Java Runtime Environment'') stands for ''virtual machine'', which is able to run Java programs.
=== JRE JDK JVM JSE ... ===


'''JDK''' (''Java Development Kit'') or '''SDK''' (''Software Developmenet Kit'') is needed to develop Java programs. Many SDK packages these days also ship JRE, or to confuse more, no separate JRE is provided and thus terminal installations are supposed to include the development environment.
Some vocabulary, if you are lost:


Terms '''AOT''' (''[http://en.wikipedia.org/wiki/AOT_compiler Ahead of Time]]''), '''SE''', '''J2EE''' need some more explanation.
* '''JRE''' Java Runtime Environment. Required to run Java code and applications. Install {{package|java-1.8.0-openjdk}}.
* '''JVM''' Java Virtual Machine. Main component of the JRE.
* '''JDK''' Java Development Kit.  Required only for development, coding.
* '''SDK''' Software Development Kit. idem JDK
* '''JavaWS''' [https://en.wikipedia.org/wiki/Java_Web_Start Java Web Start] is a framework to start application from the Internet
* '''JavaFX''' [https://en.wikipedia.org/wiki/JavaFX JavaFX] is a platform to create and deliver desktop and Rich Internet Apps.
* '''OpenJFX''' is the JavaFX Open Source implementation
* '''OpenJDK''' Open Source project behind the Java Platform http://openjdk.java.net/.
* '''IcedTea''' is a support project for OpenJDK (concern only developers) http://icedtea.classpath.org/
* '''IcedTea-Web''' is the Java Web Start package (It contains only JavaWS, No Applets anymore.) Install to run '''JNPL''' files.
* '''Applets''' Obsolete techno. Not implemented in any recent package.
* '''JSE''', '''J2SE''', '''JEE''' ... obsolete acronyms for '''J'''ava '''S'''tandard & '''E'''nterprise '''E'''dition.  ''JavaSE'' is like ''JRE''.


=== What is in Java OpenJDK package ===


= Java Runtime Environments (JRE) =
For most users, it is just another system library. It is not an application with a GUI, but it is required by some other applications to run.
You might see a ''OpenJDK Policy tool'' desktop application that comes with the package, but you should not have to use it.


Java's history is well known to consist different JRE implementations and wide variety of combinations which work together. Different implementations can be installed simultaneously to Fedora and activated one at the time. Activation is done using the [[Alternatives]] system (''also used to change some other subsystems''). Java's subsystem name is surprisingly ''java'' and typical commands include:
Beware that JavaFX and JavaWS are packaged separately!
<pre># alternatives --display java</pre>
<pre># alternatives --config java</pre>


See alternative's own documentation for more information for usage and parts involved.
== Multiple implementations ==


Should be noted that JRE implementations installed outside Fedora distribution, may not support alternatives and thus not be visible there. Then the symbolic links under directory ''/etc/alternatives'' must be manually fixed.
Fedora provides the Free {{package|java-1.8.0-openjdk}}. If this Open Source stack does not fulfill your requirements. Alternatives can be installed alongside or separately.


== OpenJDK and project IcedTea ==
The '''J'''ava '''C'''ommunity '''P'''rocess defines the specifications of the platform that many implements (IBM J9, Jikes, Zing, Zulu Dalvik ...). We will only focus on Oracle here.
Fedora has shipped OpenJDK as default JRE implementation since Fedora release 9. It's based on Sun Microsystem's [http://en.wikipedia.org/wiki/JavaOne JavaOne] open source release and complemented by Red Hat's [http://en.wikipedia.org/wiki/IcedTea IcedTea] project that implements the missing third party components that Sun could not release under free License.


OpenJDK package name on Fedora is ''java-1.6.0-openjdk''.
Multiple implementations can be installed side-by-side without interfering:
* The [[alternatives system]] allows to switch from one to another.
* An application can directly reference a specific Java installation
* Some applications include a java platform, it is then transparent for the user. (But the package is bigger.)


== GNU GCJ+GIJ for Java ==
=== Oracle version ===
The GNU Project's Java compiler and interpreter implementations provide a working JRE environment. [http://en.wikipedia.org/wiki/Gcj GCJ] is a Java compiler that produces bytecode for Java virtual machine [http://en.wikipedia.org/wiki/GNU_Interpreter_for_Java GIJ].


GCJ JRE package on Fedora is ''java-1.5.0-gcj''.
Some applications still ask for Oracle's implementation.  It is mostly based on the OpenJDK Open Source project, but there is proprietary code and Fedora does not package non-free software.


Installing Oracle Java is fine. Just beware '''not''' to use Oracle '''RPM''', as it will kill OpenJDK default packages!


== Sun Microsystems Java SE ==
Oracle provides a tarball: https://java.com/en/download/help/linux_x64_install.xml
Original Sun Microsystem's Java SE (Standard Edition) can be downloaded directly from [http://www.java.com/en/download/ http://www.java.com/en/download/] and installed manually.


Note x86_64 users: Based on [http://plugindoc.mozdev.org/faqs/java.html#Linux Mozilla FAQ] <pre>
We recommend to simply unpack the archives (tarball) to your home folder and set to path if necessary.
Sun does not currently have a working Java plugin for x86_64
</pre>
tuju@iki.fi confirms this.


== Troubleshooting JRE ==
=== Switching alternatives ===


Fedora's JRE in browser environment can be tested using the following test pages:
If you installed multiple Java implementations or version, you can configure your system to use one or another.
* [http://www.java.com/en/download/help/testvm.xml http://www.java.com/en/download/help/testvm.xml]
* [http://java.com/en/download/installed.jsp?detect=jre&try=1 http://java.com/en/download/installed.jsp?detect=jre&try=1]


'''Developers''': beware that javac has its own independent alternative. i.e. to change the JDK, use ''alternatives ... javac''!


For all Java subsystem debugging, installing the symbols package ''java-1.6.0-openjdk-debuginfo'' is essential. All debuginfo sub-packages reside in own repository which needs to be enabled for installation at least. An example yum command:
Switching is done using the [[alternatives system]] (''also used to change some other subsystems''). Java's subsystem name is surprisingly ''java'' and typical commands include:
<pre>
<pre># alternatives --display java</pre>
# yum install --enablerepo=fedora-debuginfo -y java-1.6.0-openjdk-debuginfo
<pre># alternatives --config java</pre>
</pre>


See alternative's own documentation for more information for usage and parts involved.


'''Firefox''' detected plugin list can be seen by typing the url:
Should be noted that JRE implementations installed outside Fedora distribution, may not support alternatives and thus not be visible there. Then the symbolic links under directory ''/etc/alternatives'' must be manually fixed.
<pre>about:plugins</pre>


Firefox can be run in debug mode as follows:
= Java packages in Fedora =
<pre>$ ICEDTEAPLUGIN_DEBUG=true firefox &lt;URL above&gt; 2>&1 | tee console.log
</pre>
This will write the standard output also to a file.


Browser plugin also writes files under user's
There are many aliases for OpenJDK package, see http://pkgs.fedoraproject.org/cgit/rpms/java-1.8.0-openjdk.git/tree/java-1.8.0-openjdk.spec or do "dnf repoquery --provides java-1.8.0-openjdk".
<pre>
~/.icedteaplugin/java.stdout  ~/.icedteaplugin/java.stderr
</pre>


All these files are valuable information which can/should be attached to a bug reports.
You can use any of the following names:
* java
* java-1.8.0
* java-1.8.0-openjdk
* java-openjdk
* jre
* jre-1.8.0
* jre-1.8.0-openjdk
* jre-openjdk


OpenJDK does not ship the ''Java console'' anymore, but one can be found from Firefox [https://addons.mozilla.org/en-US/firefox/addon/60 Web Developer] add-on which is installed separately to the Firefox. Add-ons are installed using Firefox's own software component management system, not Fedora's RPM.


= Java Develoment Tools (SDK) =
<pre>dnf install java-1.8.0-openjdk</pre> might be the most safe (until 1.8 is EOL.)


== Eclipse ==


See our [[Eclipse]] page for an integrated development environment platform that itself is written in Java and has plugin support for many programming languages.
'''Note''' that Java Web Start ('''JavaWS''') and '''JavaFX''' are packaged separately 'icedtea-web' and 'javafx' respectively.


== Maven ==
Typically, without JavaFX, you may have error like:
<pre>java -jar scram.jar
Error: Could not find or load main class com.frequal.scram.designer.jfx.Main</pre>


Fedora includes a somewhat customized version of Maven in the distribution. The customization is purely to make Maven work well in offline mode with the rest of the system. Details on how packagers can use this customized Maven are located at [[Java/JPPMavenReadme]] .  We are in the process of upgrading from maven2 2.0.4 to maven2 2.0.8 (ETA = F12).  Once that is achieved we will proceed immediately to maven2 2.0.9 and then to 2.0.10.  The reason for going by steps is that it is easier to bootstrap a maven2 release from the previous one.  Also related to maven2, a feasibility study is being performed to change the installation of Java packages to become a valid maven2 repository. We will no longer have to modify maven2 (not even with our small patch), and it wil be easier to support parallel installation of either "legacy" or "progressive" versions of Java packages.  Once some positive results are obtained, it will be discussed on the fedora-devel-java-list.
<pre>dnf install icedtea-web javafx</pre>


= Communicate =


= Java Server Side Environments =
You can subscribe to [https://admin.fedoraproject.org/mailman/listinfo/java-devel java-devel list] or talk to us in [irc://irc.freenode.net/fedora-java #fedora-java] Libera Chat IRC channel. Read [[Communicate]]  page for more information.


== Apache Tomcat ==
= See Also =
Fedora ships [http://en.wikipedia.org/wiki/Apache_Tomcat Apache Tomcat] as part of standard distribution.
* [[Java/FAQ]]
* [[Java/Troubleshooting]]
* [https://Ask.FedoraProject.org/en/questions/scope:all/sort:activity-desc/tags:java/page:1/ Ask Fedora about Java]


Apache Tomcat package name on Fedora is ''tomcat6''.


== JBoss ==
* [https://bugzilla.redhat.com/buglist.cgi?component=java-1.8.0-openjdk&product=Fedora&bug_status=NEW&bug_status=ASSIGNED&bug_status=MODIFIED&bug_status=ON_DEV&bug_status=ON_QA&order=bugs.votes,bugs.bug_id Java-1.8.0-OpenJDK bugs]


= Teaching and Learning Java =
* [[SIGs/Java]]
 
As part of planning and implementing new 100% FLOSS Java components into Fedora, this draft document has been opened to give developers a place to teach each other about best practices, patterns, etc.
 
[[Docs/Drafts/JavaProgramming]]
[[Category:Language-specific_SIGs]]
 
 
= Open Issues with Java packages =
* [https://bugzilla.redhat.com/buglist.cgi?component=java-1.6.0-openjdk&product=Fedora&bug_status=NEW&bug_status=ASSIGNED&bug_status=MODIFIED&bug_status=ON_DEV&bug_status=ON_QA&order=bugs.votes,bugs.bug_id java-1.6.0-openjdk]
* [https://bugzilla.redhat.com/buglist.cgi?component=java-1.5.0-gcj&product=Fedora&bug_status=NEW&bug_status=ASSIGNED&bug_status=MODIFIED&bug_status=ON_DEV&bug_status=ON_QA&order=bugs.votes,bugs.bug_id java-1.5.0-gcj]
* [https://bugzilla.redhat.com/bugzilla/buglist.cgi?product=Fedora&component=azureus Azureus]
* [https://bugzilla.redhat.com/bugzilla/buglist.cgi?product=Fedora&component=erlang erlang]
* [https://bugzilla.redhat.com/bugzilla/buglist.cgi?product=Fedora&component=itext itext]
* [https://bugzilla.redhat.com/bugzilla/buglist.cgi?product=Fedora&component=jakarta-commons-cli jakarta-commons-cli]
* [https://bugzilla.redhat.com/bugzilla/buglist.cgi?product=Fedora&component=jogl JOGL]
* [https://bugzilla.redhat.com/bugzilla/buglist.cgi?product=Fedora&component=kawa kawa]
* [https://bugzilla.redhat.com/bugzilla/buglist.cgi?product=Fedora&component=pdftk PDFTK]
* [https://bugzilla.redhat.com/bugzilla/buglist.cgi?product=Fedora&component=plplot plplot]
 
= Communicate =
 
You can subscribe to [https://www.redhat.com/mailman/listinfo/fedora-devel-java-list fedora-devel-java-list] or talk to us in [irc://irc.freenode.net/fedora-java #fedora-java] Freenode IRC channel. Read [[Communicate]]  page for more information.
 
= See Also =
* [[JavaFAQ]]
* [[JavaStackTraces]]
* [[Java/JPPMavenReadme]]
* [[Docs/Drafts/JavaProgramming]]
* [[Packaging:Java]]


= References =
= References =
* [http://openjdk.java.net/ OpenJDK Home]
* [http://openjdk.java.net/ OpenJDK Home]
* [https://bugs.openjdk.java.net/ OpenJDK bug tracking system]
* [https://wiki.openjdk.java.net/ OpenJDK Wiki]
* [http://icedtea.classpath.org/ IcedTea Home page]
* [http://icedtea.classpath.org/bugzilla/ IcedTea bug tracking system]
* [http://tomcat.apache.org/ Apache Tomcat]
* [http://java-source.net/open-source/web-servers Java web servers]
* [http://en.wikipedia.org/wiki/JBoss_application_server JBoss application server]
* [http://www.jboss.org/ JBoss Home page]
* [http://www.redhat.com/magazine/012oct05/features/java/ Red Hat Magazine article about java from 2005]
* [http://developer.classpath.org/ http://developer.classpath.org/]  
* [http://jpackage.org/ Jpackage.org]
* [http://jpackage.org/ Jpackage.org]


[[Category:Java]]
[[Category:Java]]
[[Category:Language-specific_SIGs]]

Latest revision as of 15:41, 14 July 2021

Java is about:


What do you want to do:

  • If you came here because an application ask for Java (or JRE, JVM) to be installed, then simply install Package-x-generic-16.pngjava-1.8.0-openjdk.
  • If it still does not work:
    • Install javafx and icedtea-web packages as well.
    • Lastly, and if the application ask specifically for Oracle Java: See here #Oracle_version.
  • If you want to develop, code, on the Java Platform: See Java/Development.


JRE JDK JVM JSE ...

Some vocabulary, if you are lost:

  • JRE Java Runtime Environment. Required to run Java code and applications. Install Package-x-generic-16.pngjava-1.8.0-openjdk.
  • JVM Java Virtual Machine. Main component of the JRE.
  • JDK Java Development Kit. Required only for development, coding.
  • SDK Software Development Kit. idem JDK
  • JavaWS Java Web Start is a framework to start application from the Internet
  • JavaFX JavaFX is a platform to create and deliver desktop and Rich Internet Apps.
  • OpenJFX is the JavaFX Open Source implementation
  • OpenJDK Open Source project behind the Java Platform http://openjdk.java.net/.
  • IcedTea is a support project for OpenJDK (concern only developers) http://icedtea.classpath.org/
  • IcedTea-Web is the Java Web Start package (It contains only JavaWS, No Applets anymore.) Install to run JNPL files.
  • Applets Obsolete techno. Not implemented in any recent package.
  • JSE, J2SE, JEE ... obsolete acronyms for Java Standard & Enterprise Edition. JavaSE is like JRE.

What is in Java OpenJDK package

For most users, it is just another system library. It is not an application with a GUI, but it is required by some other applications to run. You might see a OpenJDK Policy tool desktop application that comes with the package, but you should not have to use it.

Beware that JavaFX and JavaWS are packaged separately!

Multiple implementations

Fedora provides the Free Package-x-generic-16.pngjava-1.8.0-openjdk. If this Open Source stack does not fulfill your requirements. Alternatives can be installed alongside or separately.

The Java Community Process defines the specifications of the platform that many implements (IBM J9, Jikes, Zing, Zulu Dalvik ...). We will only focus on Oracle here.

Multiple implementations can be installed side-by-side without interfering:

  • The alternatives system allows to switch from one to another.
  • An application can directly reference a specific Java installation
  • Some applications include a java platform, it is then transparent for the user. (But the package is bigger.)

Oracle version

Some applications still ask for Oracle's implementation. It is mostly based on the OpenJDK Open Source project, but there is proprietary code and Fedora does not package non-free software.

Installing Oracle Java is fine. Just beware not to use Oracle RPM, as it will kill OpenJDK default packages!

Oracle provides a tarball: https://java.com/en/download/help/linux_x64_install.xml

We recommend to simply unpack the archives (tarball) to your home folder and set to path if necessary.

Switching alternatives

If you installed multiple Java implementations or version, you can configure your system to use one or another.

Developers: beware that javac has its own independent alternative. i.e. to change the JDK, use alternatives ... javac!

Switching is done using the alternatives system (also used to change some other subsystems). Java's subsystem name is surprisingly java and typical commands include:

# alternatives --display java
# alternatives --config java

See alternative's own documentation for more information for usage and parts involved.

Should be noted that JRE implementations installed outside Fedora distribution, may not support alternatives and thus not be visible there. Then the symbolic links under directory /etc/alternatives must be manually fixed.

Java packages in Fedora

There are many aliases for OpenJDK package, see http://pkgs.fedoraproject.org/cgit/rpms/java-1.8.0-openjdk.git/tree/java-1.8.0-openjdk.spec or do "dnf repoquery --provides java-1.8.0-openjdk".

You can use any of the following names:

  • java
  • java-1.8.0
  • java-1.8.0-openjdk
  • java-openjdk
  • jre
  • jre-1.8.0
  • jre-1.8.0-openjdk
  • jre-openjdk


dnf install java-1.8.0-openjdk

might be the most safe (until 1.8 is EOL.)


Note that Java Web Start (JavaWS) and JavaFX are packaged separately 'icedtea-web' and 'javafx' respectively.

Typically, without JavaFX, you may have error like:

java -jar scram.jar
Error: Could not find or load main class com.frequal.scram.designer.jfx.Main
dnf install icedtea-web javafx

Communicate

You can subscribe to java-devel list or talk to us in #fedora-java Libera Chat IRC channel. Read Communicate page for more information.

See Also


References