From Fedora Project Wiki
No edit summary
 
(48 intermediate revisions by the same user not shown)
Line 1: Line 1:
Proposed new [[Java]] page. See this "discussion" for the rationale.
Proposed new [[Java]] page ''NOT finished yet!'''. See this "discussion" for the rationale.


<div class="messagebox" style="float: right; margin-left: 10px;">__TOC__</div>


== Java ==
== Java ==


Java is about:  
Java is about:  
* Communities: the https://www.jcp.org/ to define the platform, but also User Groups https://community.oracle.com/community/java/jug  
* 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)  
* 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)
* Programming languages (Java is the most popular, but there are Scala, Groovy, Clojure ...) https://en.wikipedia.org/wiki/Java_(programming_language)




* If you came here because an application ask for Java (or JRE, JVM) to be installed, then simply install {{package|Java}}.
What do you want to do:
* If it still does not work or the application ask specifically for ''Oracle Java'': See here [[#Oracle version]].
* 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 you want to develop, code, on the Java Platform: See [[Development]]. (careful to change the link for production)
* 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 [[User:Brunovernay/Java/Development]]. ('''Careful to change the link for production''')




=== JRE JDK JVM JSE ... ===
=== JRE JDK JVM JSE ... ===


Some vocabulary:
Some vocabulary, if you are lost:


* '''JRE''' Java Runtime Environment. Required to run Java code and applications. Install {{package|Java}}.
* '''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.
* '''JVM''' Java Virtual Machine. Main component of the JRE.
* '''JDK''' Java Development Kit.  Required only for development, coding.
* '''JDK''' Java Development Kit.  Required only for development, coding.
* '''SDK''' Software Development Kit. idem JDK
* '''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/.  
* '''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''' is a support project for OpenJDK (concern only developers) http://icedtea.classpath.org/  
* '''JSE''','''J2SE''', '''JEE''' ... obsolete acronyms for '''J'''ava '''S'''tandard & '''E'''nterprise '''E'''dition.  ''JavaSE'' is like ''JRE''.
* '''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 ===
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 OpenJDK {{package|Java}}. If this Open Source stack does not fulfil your requirements. Alternatives can be installed alongside or separately.
Fedora provides the Free {{package|java-1.8.0-openjdk}}. If this Open Source stack does not fulfil 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.
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:
Multiple implementations can be installed side-by-side without interfering:
* The [alternative] system allows to switch from one to another.  
* The [[alternatives system]] allows to switch from one to another.  
* An application can directly reference a specific Java installation
* 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.)
* Some applications include a java platform, it is then transparent for the user. (But the package is bigger.)
Line 41: Line 56:
=== Oracle version ===
=== Oracle version ===


Some applications still ask for Oracle's implementation.  It is mostly based on the OpenJDK Open Source project, but there are some non-free code and Fedora does not package non-free softwares.  
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.  


Oracle provides the RPM packages: https://java.com/en/download/help/linux_rpm.xml
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 ===


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:
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:
<pre># alternatives --display java</pre>
<pre># alternatives --display java</pre>
<pre># alternatives --config java</pre>
<pre># alternatives --config java</pre>
Line 58: Line 78:
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.
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 =


== Troubleshooting ==
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".


=== shared library paths ===
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


(Is it useful here ???)


OpenJDK's '''java.library.path''', shared library paths for i386 are:
<pre>dnf install java-1.8.0-openjdk</pre> might be the most safe (until 1.8 is EOL.)
<pre>
/usr/lib
/usr/lib/jvm/java-1.?.0-openjdk-1.?.0.0.x86_64/jre/lib/
</pre>


and for x86_64:
<pre>
/usr/lib64
/usr/lib/jvm/java-1.?.0-openjdk-1.?.0.0.x86_64/jre/lib/amd64/
</pre>


OpenJDK package name on Fedora is ''java-1.?.0-openjdk''.
'''Note''' that Java Web Start ('''JavaWS''') and '''JavaFX''' are packaged separately 'icedtea-web' and 'javafx' respectively.


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>


=== Java packages in Fedora ===
<pre>dnf install icedtea-web javafx</pre>


* JavaFX (?) JavaFX is supposed to be merged in Java 8. Why is there a specific package??
= 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 =
* [[User:Brunovernay/Java/FAQ]]
* [[User:Brunovernay/Java/Troubleshooting]]
* [https://Ask.FedoraProject.org/en/questions/scope:all/sort:activity-desc/tags:java/page:1/ Ask Fedora about Java]


= Teaching and Learning 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.
* [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]


[[Docs/Drafts/JavaProgramming]]
[[Category:Language-specific_SIGs]]
= Open Issues with Java packages =
(Useful here ????)
* [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]
* [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=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]
* [https://bugzilla.redhat.com/bugzilla/buglist.cgi?product=Fedora&component=mod_cluster mod_cluster]
= 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 =
* [[Java/FAQ]]
* [[Java/Troubleshooting]]
* [[Java/PKIAppletCompatibility]]
* [[Java/StackTraces]]
* [[Java/JPPMavenReadme]]
* [[Java/FedoraJavaMarketingBrief]]
* [[Docs/Drafts/JavaProgramming]]
* [[Packaging:Java]]
* [[JDK_on_Fedora]]
* [https://developer.fedoraproject.org/tech/languages/java/java-installation.html Developer.FedoraProject.Org/Java]
* [[SIGs/Java]]
* [[SIGs/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]
* [http://www.marketwire.com/press-release/Oracle-and-IBM-Collaborate-to-Accelerate-Java-Innovation-Through-OpenJDK-NASDAQ-ORCL-1332855.htm IBM joins to OpenJDK project]


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

Latest revision as of 19:28, 4 October 2017

Proposed new Java page NOT finished yet!'. See this "discussion" for the rationale.

Java

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 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 Oracle Java: See here #Oracle_version.
  • If you want to develop, code, on the Java Platform: See User:Brunovernay/Java/Development. (Careful to change the link for production)


JRE JDK JVM JSE ...

Some vocabulary, if you are lost:

  • JRE Java Runtime Environment. Required to run Java code and applications. Install 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 Java Web Start is a framework to start application from the Internet
  • 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 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 java-1.8.0-openjdk. If this Open Source stack does not fulfil 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 Freenode IRC channel. Read Communicate page for more information.

See Also


References