= JDK on Fedora ''' [IMPORTANT] ====== This page was automatically converted from https://fedoraproject.org/wiki/JDK_on_Fedora It is probably * Badly formatted * Missing graphics and tables that do not convert 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/quick-docs 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 }} .... ====== ''' [[abstract]] Abstract ~~~~~~~~ This page provides information about *JDK* installations on Fedora. (See also https://fedoraproject.org/wiki/Java[Java].) This page will discuss mainly about Open JDK and Oracle JDK, how to install them, test and configure them on Fedora. [[what-is-jdk]] What is JDK ~~~~~~~~~~~ JDK or Java Development Kit is an implementation of Java Environment, Standard Edition and is required for Java development purposes. [[openjdk-and-project-icedtea]] OpenJDK and project IcedTea ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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. Fedora has shipped OpenJDK as default JRE implementation. It's based on Sun Microsystem's/Oracle'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/Oracle could not release under free License. About the installation, see https://developer.fedoraproject.org/tech/languages/java/java-installation.html[Developer.FedoraProject.Org/Java]. OpenJDK's *java.library.path*, shared librarary paths for i386 are: .... /usr/lib /usr/lib/jvm/java-1.?.0-openjdk-1.6.0.0.x86_64/jre/lib/ .... and for x86_64: .... /usr/lib64 /usr/lib/jvm/java-1.?.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/ .... The JDK has as its primary components a collection of programming tools, including: [[jdk-components]] JDK components ~~~~~~~~~~~~~~ appletviewer – this tool can be used to run and debug Java applets without a web browser + apt – the annotation-processing tool + extcheck – a utility which can detect JAR-file conflicts + idlj – the IDL-to-Java compiler. This utility generates Java bindings from a given Java IDL file. + jabswitch – the Java Access Bridge. Exposes assistive technologies on Microsoft Windows systems. + java – the loader for Java applications. This tool is an interpreter and can interpret the class files generated by the javac compiler. Now a single launcher is used for both development and deployment. The old deployment launcher, jre, no longer comes with Sun JDK, and instead it has been replaced by this new java loader. + javac – the Java compiler, which converts source code into Java bytecode + javadoc – the documentation generator, which automatically generates documentation from source code comments + jar – the archiver, which packages related class libraries into a single JAR file. This tool also helps manage JAR files. + javafxpackager – tool to package and sign JavaFX applications + jarsigner – the jar signing and verification tool + javah – the C header and stub generator, used to write native methods + javap – the class file disassembler + javaws – the Java Web Start launcher for JNLP applications + JConsole – Java Monitoring and Management Console + jdb – the debugger + jhat – Java Heap Analysis Tool (experimental) + jinfo – This utility gets configuration information from a running Java process or crash dump. (experimental) + jmap – This utility outputs the memory map for Java and can print shared object memory maps or heap memory details of a given process or core dump. (experimental) + jmc – Java Mission Control + jps – Java Virtual Machine Process Status Tool lists the instrumented HotSpot Java Virtual Machines (JVMs) on the target system. (experimental) + jrunscript – Java command-line script shell. + jstack – utility which prints Java stack traces of Java threads (experimental) + jstat – Java Virtual Machine statistics monitoring tool (experimental) + jstatd – jstat daemon (experimental) + keytool – tool for manipulating the keystore + pack200 – JAR compression tool + policytool – the policy creation and management tool, which can determine policy for a Java runtime, specifying which permissions are available for code from various sources VisualVM – visual tool integrating several command-line JDK tools and lightweight clarification needed] performance and memory profiling capabilities + wsimport – generates portable JAX-WS artifacts for invoking a web service. + xjc – Part of the Java API for XML Binding (JAXB) API. It accepts an XML schema and generates Java classes. + Experimental tools may not be available in future versions of the JDK. The JDK also comes with a complete Java Runtime Environment, usually called a private runtime, due to the fact that it is separated from the "regular" JRE and has extra contents. It consists of a Java Virtual Machine and all of the class libraries present in the production environment, as well as additional libraries only useful to developers, such as the internationalization libraries and the IDL libraries. Copies of the JDK also include a wide selection of example programs demonstrating the use of almost all portions of the Java API. OpenJDK package name on Fedora is _java-1.?.0-openjdk_. [[oracle-jdk]] Oracle JDK ~~~~~~~~~~ Oracle provides JDK (Java Development Kit) for Java Developers. It includes a complete JRE plus tools for developing, debugging, and monitoring Java applications. [[installing-oracle-jdk-on-fedora]] Installing Oracle JDK on Fedora ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \1. Download the Oracle Java JDK http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html[here] + Note: download appropriate file, for example if your system is x64 Fedora the download file is named like this: jdk-8u45-linux-x64.tar.gz + 2. Create a folder named java in /usr/local/by this command: .... sudo mkdir -p /usr/local/java .... folder is created in root/usr/local/java + 3. Copy the Downloaded file in the directory /usr/local/java. To do this, cd into directory where downloaded file is located and use this command for copying that file to /usr/local/java/: .... sudo cp -r jdk-8u40-linux-x64.tar.gz /usr/local/java .... \4. CD into /usr/local/java/ directory and extract that copied file by using this command: .... sudo tar xvzf jdk-8u45-linux-x64.tar.gz .... \5. After extraction you must see a folder named jdk1.8.0_45. + 6. Update PATH file by opening /etc/profile file by the command .... sudo nano /etc/profile and paste the following at the end of the file: JAVA_HOME=/usr/local/java/jdk1.8.0_45 PATH=$PATH:$HOME/bin:$JAVA_HOME/bin export JAVA_HOME export PATH .... > 7. Save and exit. + 8. Tell the system that the new Oracle Java version is available by the following commands: .... sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_45/bin/java" 1 sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.8.0_45/bin/javac" 1 sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.8.0_45/bin/javaws" 1 .... \9. Make Oracle Java JDK as default by this following commands: .... sudo update-alternatives --set java /usr/local/java/jdk1.8.0_45/bin/java sudo update-alternatives --set javac /usr/local/java/jdk1.8.0_45/bin/javac sudo update-alternatives --set javaws /usr/local/java/jdk1.8.0_45/bin/javaws .... \10. Reload sytem wide PATH /etc/profile by this command: .... source /etc/profile .... \11. Reboot your system. .... reboot .... \12. Check Java JDK version by java -version command . If installation is succesful, it will display like the following: .... java version "1.8.0_45" Java(TM) SE Runtime Environment (build 1.8.0_45-xxx) Java HotSpot(TM) Server VM (build 25.45-xxx, mixed mode) .... That's it! Note: We Assumed that the downloaded file is named jdk-8u45-linux-x64.tar.gz and used this name in all the commands used in steps 2, 4 and 5. It may depends on the type of O.S, processor type (i.e., 32bit or 64bit) ''' 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/quick-docs.