= Java

'''

[IMPORTANT]
======

This page was automatically converted from https://fedoraproject.org/wiki/Java

It is probably

* Badly formatted
* Missing graphics and tables that do not covert well from mediawiki
* Out-of-date
* In need of other love

Please fix it, remove this notice, and then add to `_topic_map.yml`

Pull requests accepted at https://pagure.io/fedora-docs/fedora-howto

Once that is live, go to the original wiki page and add an `{{old}}`
tag, followed by a note like

....
{{admon/note|This page has a new home!|
This wiki page is no longer maintained. Please find the up-to-date
version at: https://docs.fedoraproject.org/whatever-the-url
}}
....

======

'''


__TOC__

Java is about:

* Communities: the https://www.jcp.org/[Java Comunity 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)

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 .
* 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.

[[jre-jdk-jvm-jse-...]]
JRE JDK JVM JSE ...
^^^^^^^^^^^^^^^^^^^

Some vocabulary, if you are lost:

* *JRE* Java Runtime Environment. Required to run Java code and
applications. Install .
* *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 plateform
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]]
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]]
Multiple implementations
~~~~~~~~~~~~~~~~~~~~~~~~

Fedora provides the Free . If this Open Source stack does not fulfil
your requirements. Alternatives can be installed alongside or
separately.

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.

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

* The link:alternatives_system[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]]
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]]
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 link:alternatives_system[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]]
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]]
Communicate
-----------

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]
Freenode IRC channel. Read Communicate page for more information.

[[see-also]]
See Also
--------

* Java/FAQ
* Java/Troubleshooting
* https://Ask.FedoraProject.org/en/questions/scope:all/sort:activity-desc/tags:java/page:1/[Ask
Fedora about Java]

* 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]

* SIGs/Java

[[references]]
References
----------

* http://openjdk.java.net/[OpenJDK Home]
* https://wiki.openjdk.java.net/[OpenJDK Wiki]
* http://jpackage.org/[Jpackage.org]

Category:Java Category:Language-specific_SIGs
'''

See a typo, something missing or out of date, or anything else which can be
improved? Edit this document at https://pagure.io/fedora-docs/fedora-howto.
