[784a1a7f] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 |
|
---|
[62d70cb] | 7 | <!-- Maintainer: before making the tarball, remove all .debuginfo files from
|
---|
[c7a230b] | 8 | the directory: this saves more than 70 MB. -->
|
---|
| 9 | <!-- 32-bit binary for JDK12 pending, will be done before 9.0 releases -->
|
---|
[a29486e4] | 10 | <!ENTITY anduin-download "&sources-anduin-http;/OpenJDK/OpenJDK-&openjdk-version;">
|
---|
[73f5c6c] | 11 | <!ENTITY openjdk-download-binary-x86 "&sources-anduin-http;/OpenJDK/OpenJDK-11.0.2/OpenJDK-11.0.2+9-i686-bin.tar.xz">
|
---|
[c599277] | 12 | <!ENTITY openjdk-bin-md5sum-x86 "2b917647040e9804e0f3ccd51f40394b">
|
---|
| 13 | <!ENTITY openjdk-bin-size-x86 "158 MB">
|
---|
[fedac85] | 14 | <!ENTITY openjdk-bin-buildsize-x86 "273 MB">
|
---|
[784a1a7f] | 15 |
|
---|
[fedac85] | 16 | <!-- Not uploaded to anduin, since this file is now available under GNU GPLv2
|
---|
| 17 | licence.-->
|
---|
[c599277] | 18 | <!-- I've crafted a binary in case the version is removed from Oracle after
|
---|
| 19 | BLFS 8.4 is released. -->
|
---|
[c7a230b] | 20 | <!ENTITY openjdk-download-binary-x64 "https://download.java.net/java/GA/jdk12.0.2/e482c34c86bd4bf8b56c0b35558996b9/&openjdk-build;/GPL/openjdk-&openjdk-version;_linux-x64_bin.tar.gz">
|
---|
| 21 | <!ENTITY openjdk-bin-md5sum-x64 "f5da6f4dec81bdd2a096184ec1d69216">
|
---|
| 22 | <!ENTITY openjdk-bin-size-x64 "189 MB">
|
---|
[fedac85] | 23 | <!ENTITY openjdk-bin-buildsize-x64 "296 MB">
|
---|
[784a1a7f] | 24 | ]>
|
---|
| 25 |
|
---|
[88b2f2ef] | 26 | <sect1 id="java" xreflabel="Java-&openjdk-version;">
|
---|
[784a1a7f] | 27 | <?dbhtml filename="java.html"?>
|
---|
| 28 |
|
---|
| 29 | <sect1info>
|
---|
| 30 | <othername>$LastChangedBy$</othername>
|
---|
| 31 | <date>$Date$</date>
|
---|
| 32 | </sect1info>
|
---|
| 33 |
|
---|
[d7df10f3] | 34 | <title>Java-&openjdk-version;</title>
|
---|
[784a1a7f] | 35 |
|
---|
| 36 | <indexterm zone="java">
|
---|
| 37 | <primary sortas="a-java">JDK Binary</primary>
|
---|
| 38 | </indexterm>
|
---|
| 39 |
|
---|
| 40 |
|
---|
[d7df10f3] | 41 | <sect2>
|
---|
| 42 | <title>About Java</title>
|
---|
| 43 | <para>Java is different from most of the packages in LFS and BLFS. It
|
---|
| 44 | is a programming language that works with files of byte codes to obtain
|
---|
[f3429309] | 45 | instructions and executes then in a Java Virtual Machine (JVM). An
|
---|
[d7df10f3] | 46 | introductory java program looks like:</para>
|
---|
[784a1a7f] | 47 |
|
---|
[f3429309] | 48 | <screen><literal>public class HelloWorld
|
---|
[784a1a7f] | 49 | {
|
---|
[f3429309] | 50 | public static void main(String[] args)
|
---|
[784a1a7f] | 51 | {
|
---|
| 52 | System.out.println("Hello, World");
|
---|
| 53 | }
|
---|
| 54 | }</literal></screen>
|
---|
| 55 |
|
---|
[d7df10f3] | 56 | <para>This program is saved as <filename>HelloWorld.java</filename>. The
|
---|
| 57 | file name, <emphasis>HelloWorld</emphasis>, must match the class name. It
|
---|
| 58 | is then converted into byte code with
|
---|
| 59 | <command>javac HelloWorld.java</command>. The output file is
|
---|
| 60 | <filename>HelloWorld.class</filename>. The program is executed with
|
---|
| 61 | <command>java HelloWorld</command>. This creates a JVM and runs the
|
---|
| 62 | code. The 'class' extension must not be specified.</para>
|
---|
| 63 |
|
---|
| 64 | <para>Several class files can be combined into one file with the
|
---|
| 65 | <command>jar</command> command. This is similar to the standard
|
---|
| 66 | <command>tar</command> command. For instance, the command
|
---|
| 67 | <command>jar cf myjar.jar *.class</command> will combine all class files
|
---|
| 68 | in a directory into one jar file. These act as library files.</para>
|
---|
| 69 |
|
---|
| 70 | <para>The JVM can search for and use classes in jar files automatically.
|
---|
| 71 | It uses the <envar>CLASSPATH</envar> environment variable to search for
|
---|
| 72 | jar files. This is a standard list of colon-separated directory names
|
---|
| 73 | similar to the <envar>PATH</envar> environment variable.</para>
|
---|
[f3429309] | 74 |
|
---|
[d7df10f3] | 75 | </sect2>
|
---|
[784a1a7f] | 76 |
|
---|
[06d0bed1] | 77 | <sect2 id="java-bin" xreflabel="Java Binary" role="package">
|
---|
| 78 | <title>Binary JDK Information</title>
|
---|
[784a1a7f] | 79 |
|
---|
| 80 | <para>Creating a JVM from source requires a set of circular dependencies.
|
---|
| 81 | The first thing that's needed is a set of programs called a Java Development
|
---|
[f3429309] | 82 | Kit (JDK). This set of programs includes <command>java</command>,
|
---|
| 83 | <command>javac</command>, <command>jar</command>, and several others. It
|
---|
[784a1a7f] | 84 | also includes several base <emphasis>jar</emphasis> files.</para>
|
---|
| 85 |
|
---|
| 86 | <para>To start, we set up a binary installation of the JDK created
|
---|
| 87 | by the BLFS editors. It is installed in the <filename>/opt</filename>
|
---|
| 88 | directory to allow for multiple installations, including a source based
|
---|
| 89 | version.</para>
|
---|
| 90 |
|
---|
[1159b21] | 91 | &lfs90_checked;
|
---|
[d7df10f3] | 92 |
|
---|
[784a1a7f] | 93 | <bridgehead renderas="sect3">Binary Package Information</bridgehead>
|
---|
| 94 | <itemizedlist spacing="compact">
|
---|
| 95 | <listitem>
|
---|
| 96 | <para>Binary download (x86):
|
---|
| 97 | <ulink url="&openjdk-download-binary-x86;"/></para>
|
---|
| 98 | </listitem>
|
---|
| 99 | <listitem>
|
---|
| 100 | <para>Download MD5 sum: &openjdk-bin-md5sum-x86;</para>
|
---|
| 101 | </listitem>
|
---|
| 102 | <listitem>
|
---|
| 103 | <para>Download size (binary): &openjdk-bin-size-x86;</para>
|
---|
| 104 | </listitem>
|
---|
| 105 | <listitem>
|
---|
| 106 | <para>Estimated disk space required: &openjdk-bin-buildsize-x86;</para>
|
---|
| 107 | </listitem>
|
---|
| 108 | </itemizedlist>
|
---|
| 109 | <itemizedlist spacing="compact">
|
---|
| 110 | <listitem>
|
---|
| 111 | <para>Binary download (x86_64):
|
---|
| 112 | <ulink url="&openjdk-download-binary-x64;"/></para>
|
---|
| 113 | </listitem>
|
---|
| 114 | <listitem>
|
---|
| 115 | <para>Download MD5 sum: &openjdk-bin-md5sum-x64;</para>
|
---|
| 116 | </listitem>
|
---|
| 117 | <listitem>
|
---|
| 118 | <para>Download size (binary): &openjdk-bin-size-x64;</para>
|
---|
| 119 | </listitem>
|
---|
| 120 | <listitem>
|
---|
| 121 | <para>Estimated disk space required: &openjdk-bin-buildsize-x64;</para>
|
---|
| 122 | </listitem>
|
---|
| 123 | </itemizedlist>
|
---|
[3cd08693] | 124 |
|
---|
| 125 | <bridgehead renderas="sect3">Java Binary Runtime Dependencies</bridgehead>
|
---|
| 126 | <para role="required">
|
---|
[572553b] | 127 | <xref role="runtime" linkend="alsa-lib"/>,
|
---|
| 128 | <xref role="runtime" linkend="cups"/>,
|
---|
| 129 | <xref role="runtime" linkend="giflib"/>, and
|
---|
| 130 | <xref role="runtime" linkend="xorg7-lib"/>
|
---|
[3cd08693] | 131 | </para>
|
---|
[d7df10f3] | 132 |
|
---|
[06d0bed1] | 133 | </sect2>
|
---|
[3cd08693] | 134 |
|
---|
[06d0bed1] | 135 | <sect2 role="installation">
|
---|
| 136 | <title>Installation of the Java BinaryJDK </title>
|
---|
[784a1a7f] | 137 | <para>Begin by extracting the appropriate binary tarball for your
|
---|
[debb88bf] | 138 | architecture and changing to the extracted directory. Install the binary
|
---|
[784a1a7f] | 139 | <application>OpenJDK</application> with the following commands as the
|
---|
| 140 | <systemitem class="username">root</systemitem> user:</para>
|
---|
| 141 |
|
---|
[d61ead0a] | 142 | <screen role="root"><userinput>install -vdm755 /opt/OpenJDK-&openjdk-version;+&openjdk-build;-bin &&
|
---|
| 143 | mv -v * /opt/OpenJDK-&openjdk-version;+&openjdk-build;-bin &&
|
---|
| 144 | chown -R root:root /opt/OpenJDK-&openjdk-version;+&openjdk-build;-bin</userinput></screen>
|
---|
[784a1a7f] | 145 |
|
---|
[58cba7f0] | 146 | <para>
|
---|
| 147 | The binary version is now installed. You may create a symlink to that
|
---|
| 148 | version by issuing, as the <systemitem class="username">root</systemitem>
|
---|
| 149 | user:
|
---|
| 150 | </para>
|
---|
| 151 |
|
---|
[d61ead0a] | 152 | <screen role="root"><userinput>ln -sfn OpenJDK-&openjdk-version;+&openjdk-build;-bin /opt/jdk</userinput></screen>
|
---|
[58cba7f0] | 153 |
|
---|
| 154 | <para>
|
---|
| 155 | You may now proceed to <xref linkend="ojdk-conf"/>, where the
|
---|
| 156 | instructions assume that the above link exists.
|
---|
| 157 | </para>
|
---|
[88b2f2ef] | 158 |
|
---|
[784a1a7f] | 159 | </sect2>
|
---|
| 160 |
|
---|
| 161 | </sect1>
|
---|