%general-entities; ]> $LastChangedBy$ $Date$ OpenJDK-&openjdk-version; OpenJDK Introduction to OpenJDK OpenJDK is an open-source implementation of Oracle's Java Standard Edition platform. OpenJDK is useful for developing Java programs, and provides a complete runtime environment to run Java programs. &lfs82_checked; A browser plugin and webstart implementation is provided by the Icedtea project. To provide a complete implementation, you will need to later install . OpenJDK is GPL'd code, with a special exception made for non-free projects to use these classes in their proprietary products. In similar fashion to the LGPL, which allows non-free programs to link to libraries provided by free software, the GNU General Public License, version 2, with the Classpath Exception allows third party programs to use classes provided by free software without the requirement that the third party software also be free. As with the LGPL, any modifications made to the free software portions of a third party application, must also be made freely available. The OpenJDK source includes a very thorough, open source test suite using the JTreg test harness. The testing instructions below allow to test the just built JDK for reasonable compatibility with the proprietary Oracle JDK. However, in order for an independent implementation to claim compatibility, it must pass a proprietary JCK/TCK test suite. No claims of compatibility, even partial compatibility, may be made without passing an approved test suite. Oracle does provide free community access, on a case by case basis, to a closed toolkit to ensure 100% compatibility with its proprietary JDK. Neither the binary version provided on the page nor the JVM built with the instructions below have been tested against the TCK. Any version that is built using the instructions given, cannot claim to be compatible with the proprietary JDK, without the user applying for, and completing the compatibility tests themselves. With that in mind, the binaries produced using this build method are regularly tested against the TCK by the members listed on the site above. In addition to the community license above, an educational, non-commercial license for the TCK can be obtained from here. Source Package Information Download (HTTP): Download (FTP): Download MD5 sum: &ojdk-md5sum; Download Size: &ojdk-size; In addition to the root package, the instructions below first download seven subproject tarballs, whose total size is &total-download-size;. Estimated disk space required: &ojdk-bdsize; Estimated build time: &ojdk-time; Additional Downloads Optional test harness Download MD5 sum: &jtreg-md5sum; Download Size: &jtreg-size; OpenJDK Dependencies Required Dependencies An existing binary ( or an earlier built version of this package. The instructions below assume that you are using ), , , , , , , and Recommended , , , , , and Optional and an X Window manager such as (for the tests) User Notes: Installation of OpenJDK Unlike other packages in BLFS, the OpenJDK source packages are distributed in multiple tarballs. You need to first extract the source root from &ojdk-tarball;, change into the extracted directory, then proceed with the following instructions: cat > subprojects.md5 << EOF && &corba-md5sum; corba.tar.bz2 &hotspot-md5sum; hotspot.tar.bz2 &jaxp-md5sum; jaxp.tar.bz2 &jaxws-md5sum; jaxws.tar.bz2 &jdk-md5sum; jdk.tar.bz2 &langtools-md5sum; langtools.tar.bz2 &nashorn-md5sum; nashorn.tar.bz2 EOF for subproject in corba hotspot jaxp jaxws jdk langtools nashorn; do wget -c &ojdk-repo;/${subproject}/archive/&ojdk-tarball; \ -O ${subproject}.tar.bz2 done && md5sum -c subprojects.md5 && for subproject in corba hotspot jaxp jaxws jdk langtools nashorn; do mkdir -pv ${subproject} && tar -xf ${subproject}.tar.bz2 --strip-components=1 -C ${subproject} done If you have downloaded the optional test harness, unpack it too: tar -xf ../jtreg-&jtreg-version;.tar.gz Before proceeding, you should ensure that your environment PATH variable contains the location of the Java compiler used for bootstrapping OpenJDK. This is the only requirement for the environment. Modern Java installations do not need JAVA_HOME and CLASSPATH is not used here. Furthermore, OpenJDK developers recommend to unset JAVA_HOME. The build system does not support the switch in MAKEFLAGS. Configure and build the package with the following commands (--with-milestone value can be modified to fit user preferences): unset JAVA_HOME && bash configure --enable-unlimited-crypto \ --disable-warnings-as-errors \ --with-stdc++lib=dynamic \ --with-giflib=system \ --with-jtreg=$PWD/jtreg \ --with-lcms=system \ --with-libjpeg=system \ --with-libpng=system \ --with-zlib=system \ --with-version-build="11" \ --with-version-pre="" \ --with-version-opt="" \ --with-cacerts-file=/etc/ssl/java/cacerts.jks && make images By default, the build system will use (NUMCPU - 1) jobs. To override, set JOBS=<X> on make invocation. To test the results, issue: make run-test-tier1. Seven tests are expected to fail, and 11 to error when building only the server target. You can limit the number of concurrent tests by setting JTREG="JOBS=<X>" where <X> is the number of jobs. Install the package with the following commands as the root user: install -vdm755 /opt/jdk-&openjdk-version;+&openjdk-build; && cp -Rv build/*/images/jdk/* /opt/jdk-&openjdk-version;+&openjdk-build; && chown -R root:root /opt/jdk-&openjdk-version;+&openjdk-build; && find /opt/jdk-&openjdk-version;+&openjdk-build; -name \*.diz -delete && for s in 16 24 32 48; do install -Dm 644 jdk/src/java.desktop/unix/classes/sun/awt/X11/java-icon${s}.png \ /usr/share/icons/hicolor/${s}x${s}/apps/java9.png done If you only wish to install the Java Runtime Environment, you can substitue build/*/images/jre in the above cp command. There are now two OpenJDK SDKs installed in /opt. You should decide on which one you would like to use as the default. Normally, you would opt for the just installed OpenJDK. If so, do the following as the root user: ln -v -nsf jdk-&openjdk-version;+&openjdk-build; /opt/jdk If desired, you may create .desktop files to add entries in the menu for java, policytool, and jconsole. The needed icons have already been installed. As the root user: mkdir -pv /usr/share/applications && cat > /usr/share/applications/openjdk-9-java.desktop << "EOF" && [Desktop Entry] Name=OpenJDK Java 9 Runtime Comment=OpenJDK Java 9 Runtime Exec=/opt/jdk/bin/java -jar Terminal=false Type=Application Icon=java9 MimeType=application/x-java-archive;application/java-archive;application/x-jar; NoDisplay=true EOF cat > /usr/share/applications/openjdk-9-policytool.desktop << "EOF" && [Desktop Entry] Name=OpenJDK Java 9 Policy Tool Name[pt_BR]=OpenJDK Java 9 - Ferramenta de Política Comment=OpenJDK Java 9 Policy Tool Comment[pt_BR]=OpenJDK Java 9 - Ferramenta de Política Exec=/opt/jdk/bin/policytool Terminal=false Type=Application Icon=java9 Categories=Settings; EOF cat > /usr/share/applications/openjdk-9-jconsole.desktop << "EOF" [Desktop Entry] Name=OpenJDK Java 9 Console Comment=OpenJDK Java 9 Console Keywords=java;console;monotoring Exec=/opt/jdk/bin/jconsole Terminal=false Type=Application Icon=java9 Categories=Application;System; EOF The choice of pt_BR is just an example. You can add any translation by adding lines corresponding to your locale, e.g. for fr_FR, Name[fr_FR]= and Comment[fr_FR]= with the appropriate text as values. Command Explanations bash configure...: the top level configure is a wrapper around the autotools one. It is not executable and must be run through bash. --enable-unlimited-crypto: Because of limitations on the usage of cryptography in some countries, there is the possibility to limit the size of encryption keys and the use of some algorithms in a policy file. This switch allows to ship a policy file with no restriction. It is the responsibility of the user to ensure proper adherence to the law. --disable-warnings-as-errors: This switch disables use of -Werror in the build. --with-stdc++lib=dynamic: This switch forces the build system to link to libstdc++.so (dynamic) instead of libstdc++.a (static). --with-jtreg=$PWD/jtreg: This switch tells configure where to find jtreg. Omit if you have not downloaded the optional test suite. --with-{giflib,lcms,libjpeg,libpng,zlib}=system: These switches force the build system to use the system libraries instead of the bundled versions. --with-version-build: Currently, the build system does not include the build number in the version string. It has to be specified here. --with-version-pre: This switch allows you to prefix the version string with a custom string. --with-version-opt: This switch allows you to add an optional build description to the version string. --with-cacerts-file=/etc/ssl/java/cacerts.jks: Specifies where to find a cacerts file, /etc/ssl/java/cacerts on a BLFS system. Otherwise, an empty one is created. You can use the /usr/sbin/make-ca --force command to generate it, once you have installed the Java binaries. : This switch provides the location of the temporary JDK. It is normally not needed if java is found in the PATH. find ... -iname '*.diz' -delete: This command removes redundant files. Configuring OpenJDK Configuration Information Normally, the JAVA environment has been configured after installing the binary version, and can be used with the just built package as well. Review in case you want to modify something. To test if the man pages are correctly installed, issue source /etc/profile and man java to display the respective man page. Install or update the JRE Certificate Authority Certificates (cacerts) file OpenJDK uses its own format for the CA certificates. Those certificates are located in a file named /etc/ssl/java/cacerts.jks. That file should be generated using the system PKI trust store. The instructions on the page should be used to update the file located in /etc/ssl/java. Setup a symlink in the default location as the root user: ln -sfv /etc/ssl/java/cacerts.jks /opt/jdk/lib/security/cacerts Use the following commands to check if the cacerts file has been successfully installed: cd /opt/jdk bin/keytool -list -keystore /etc/ssl/java/cacerts At the prompt "Enter keystore password:", enter "changeit" (the default). If the cacerts file was installed correctly, you will see a list of the certificates with related information for each one. If not, you need to reinstall them. Contents Installed Programs Installed Libraries Installed Directory appletviewer, extcheck, idlj, jar, jarsigner, java, javac, javadoc, javah, javap, java-rmi.cgi, jcmd, jconsole, jdb, jdeps, jhat, jinfo, jjs, jmap, jps, jrunscript, jsadebugd, jstack, jstat, jstatd, keytool, native2ascii, orbd, pack200, policytool, rmic, rmid, rmiregistry, schemagen, serialver, servertool, tnameserv, unpack200, wsgen, wsimport, and xjc /opt/OpenJDK-&openjdk-version;/lib/*, and /opt/OpenJDK-&openjdk-version;/jre/lib/* /opt/OpenJDK-&openjdk-version; Short Descriptions appletviewer allows to run applets outside of a web browser. appletviewer extcheck checks a specified jar file for title and version conflicts with any extensions installed in the OpenJDK software. extcheck idlj generates Java bindings from a given IDL file. idlj jar combines multiple files into a single jar archive. jar jarsigner signs jar files and verifies the signatures and integrity of a signed jar file. jarsigner java launches a Java application by starting a Java runtime environment, loading a specified class and invoking its main method. java javac reads class and interface definitions, written in the Java programming language, and compiles them into bytecode class files. javac javadoc parses the declarations and documentation comments in a set of Java source files and produces a corresponding set of HTML pages describing the classes, interfaces, constructors, methods, and fields. javadoc javah generates C header and source files that are needed to implement native methods. javah javap disassembles a Java class file. javap java-rmi.cgi is the Java RMI client. java-rmi.cgi jcmd is a utility to send diagnostic command requests to a running Java Virtual Machine. jcmd jconsole is a graphical console tool to monitor and manage both local and remote Java applications and virtual machines. jconsole jdb is a simple command-line debugger for Java classes. jdb jdeps shows the package-level or class-level dependencies of Java class files. jdeps jhat parses a java heap dump file and allows viewing it in a web browser. jhat jinfo prints Java configuration information for a given Java process, core file, or a remote debug server. jinfo jjs is a command-line tool used to invoke the Nashorn engine. It can be used to interpret one or several script files, or to run an interactive shell. jjs jmap prints shared object memory maps or heap memory details of a given process, core file, or a remote debug server. jmap jps lists the instrumented JVMs on the target system. jps jrunscript is a command line script shell. jrunscript jsadebugd attaches to a Java process or core file and acts as a debug server. jsadebugd jstack prints Java stack traces of Java threads for a given Java process, core file, or a remote debug server. jstack jstat displays performance statistics for an instrumented JVM. jstat jstatd is an RMI server application that monitors for the creation and termination of instrumented JVMs. jstatd keytool is a key and certificate management utility. keytool native2ascii converts files that contain non-supported character encoding into files containing Latin-1 or Unicode-encoded characters. native2ascii orbd is used to enable clients to transparently locate and invoke persistent objects on servers in the CORBA environment. orbd pack200 is a Java application that transforms a jar file into a compressed pack200 file using the Java gzip compressor. pack200 policytool creates and manages a policy file graphically. policytool rmic generates stub and skeleton class files for remote objects from the names of compiled Java classes that contain remote object implementations. rmic rmid starts the activation system daemon. rmid rmiregistry creates and starts a remote object registry on the specified port on the current host. rmiregistry schemagen is a Java XML binding schema generator. schemagen serialver returns the serialVersionUID for one or more classes in a form suitable for copying into an evolving class. serialver servertool provides an ease-of-use interface for application programmers to register, unregister, startup and shutdown a server. servertool tnameserv starts the Java IDL name server. tnameserv unpack200 is a native implementation that transforms a packed file produced by pack200 into a jar file. unpack200 wsgen generates JAX-WS portable artifacts used in JAX-WS web services. wsgen wsimport generates JAX-WS portable artifacts. wsimport xjc is a Java XML binding compiler. xjc