[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>
|
---|
[de33b2a] | 43 | <para>
|
---|
| 44 | Java is different from most of the packages in LFS and BLFS. It
|
---|
| 45 | is a programming language that works with files of byte codes to obtain
|
---|
| 46 | instructions and executes then in a Java Virtual Machine (JVM). An
|
---|
| 47 | introductory java program looks like:
|
---|
| 48 | </para>
|
---|
[784a1a7f] | 49 |
|
---|
[f3429309] | 50 | <screen><literal>public class HelloWorld
|
---|
[784a1a7f] | 51 | {
|
---|
[f3429309] | 52 | public static void main(String[] args)
|
---|
[784a1a7f] | 53 | {
|
---|
| 54 | System.out.println("Hello, World");
|
---|
| 55 | }
|
---|
| 56 | }</literal></screen>
|
---|
| 57 |
|
---|
[de33b2a] | 58 | <para>
|
---|
| 59 | This program is saved as <filename>HelloWorld.java</filename>. The
|
---|
| 60 | file name, <emphasis>HelloWorld</emphasis>, must match the class name.
|
---|
| 61 | It is then converted into byte code with
|
---|
| 62 | <command>javac HelloWorld.java</command>. The output file is
|
---|
| 63 | <filename>HelloWorld.class</filename>. The program is executed with
|
---|
| 64 | <command>java HelloWorld</command>. This creates a JVM and runs the
|
---|
| 65 | code. The 'class' extension must not be specified.
|
---|
| 66 | </para>
|
---|
| 67 |
|
---|
| 68 | <para>
|
---|
| 69 | Several class files can be combined into one file with the
|
---|
| 70 | <command>jar</command> command. This is similar to the standard
|
---|
| 71 | <command>tar</command> command. For instance, the command
|
---|
| 72 | <command>jar cf myjar.jar *.class</command> will combine all class files
|
---|
| 73 | in a directory into one jar file. These act as library files.
|
---|
| 74 | </para>
|
---|
| 75 |
|
---|
| 76 | <para>
|
---|
| 77 | The JVM can search for and use classes in jar files automatically.
|
---|
| 78 | It uses the <envar>CLASSPATH</envar> environment variable to search for
|
---|
| 79 | jar files. This is a standard list of colon-separated directory names
|
---|
| 80 | similar to the <envar>PATH</envar> environment variable.
|
---|
| 81 | </para>
|
---|
[f3429309] | 82 |
|
---|
[d7df10f3] | 83 | </sect2>
|
---|
[784a1a7f] | 84 |
|
---|
[06d0bed1] | 85 | <sect2 id="java-bin" xreflabel="Java Binary" role="package">
|
---|
| 86 | <title>Binary JDK Information</title>
|
---|
[784a1a7f] | 87 |
|
---|
[de33b2a] | 88 | <para>
|
---|
| 89 | Creating a JVM from source requires a set of circular dependencies.
|
---|
| 90 | The first thing that's needed is a set of programs called a Java
|
---|
| 91 | Development Kit (JDK). This set of programs includes
|
---|
| 92 | <command>java</command>, <command>javac</command>,
|
---|
| 93 | <command>jar</command>, and several others. It also includes several
|
---|
| 94 | base <emphasis>jar</emphasis> files.
|
---|
| 95 | </para>
|
---|
[784a1a7f] | 96 |
|
---|
[de33b2a] | 97 | <para>
|
---|
| 98 | To start, we set up a binary installation of the JDK created
|
---|
| 99 | by the BLFS editors. It is installed in the <filename>/opt</filename>
|
---|
| 100 | directory to allow for multiple installations, including a source based
|
---|
| 101 | version.
|
---|
| 102 | </para>
|
---|
[784a1a7f] | 103 |
|
---|
[5ed7fdf] | 104 | &lfs91_checked;
|
---|
[d7df10f3] | 105 |
|
---|
[784a1a7f] | 106 | <bridgehead renderas="sect3">Binary Package Information</bridgehead>
|
---|
| 107 | <itemizedlist spacing="compact">
|
---|
| 108 | <listitem>
|
---|
[de33b2a] | 109 | <para>
|
---|
| 110 | Binary download (x86): <ulink url="&openjdk-download-binary-x86;"/>
|
---|
| 111 | </para>
|
---|
[784a1a7f] | 112 | </listitem>
|
---|
| 113 | <listitem>
|
---|
[de33b2a] | 114 | <para>
|
---|
| 115 | Download MD5 sum: &openjdk-bin-md5sum-x86;
|
---|
| 116 | </para>
|
---|
[784a1a7f] | 117 | </listitem>
|
---|
| 118 | <listitem>
|
---|
[de33b2a] | 119 | <para>
|
---|
| 120 | Download size (binary): &openjdk-bin-size-x86;
|
---|
| 121 | </para>
|
---|
[784a1a7f] | 122 | </listitem>
|
---|
| 123 | <listitem>
|
---|
[de33b2a] | 124 | <para>
|
---|
| 125 | Estimated disk space required: &openjdk-bin-buildsize-x86;
|
---|
| 126 | </para>
|
---|
[784a1a7f] | 127 | </listitem>
|
---|
| 128 | </itemizedlist>
|
---|
| 129 | <itemizedlist spacing="compact">
|
---|
| 130 | <listitem>
|
---|
[de33b2a] | 131 | <para>
|
---|
| 132 | Binary download (x86_64): <ulink url="&openjdk-download-binary-x64;"/>
|
---|
| 133 | </para>
|
---|
[784a1a7f] | 134 | </listitem>
|
---|
| 135 | <listitem>
|
---|
[de33b2a] | 136 | <para>
|
---|
| 137 | Download MD5 sum: &openjdk-bin-md5sum-x64;
|
---|
| 138 | </para>
|
---|
[784a1a7f] | 139 | </listitem>
|
---|
| 140 | <listitem>
|
---|
[de33b2a] | 141 | <para>
|
---|
| 142 | Download size (binary): &openjdk-bin-size-x64;
|
---|
| 143 | </para>
|
---|
[784a1a7f] | 144 | </listitem>
|
---|
| 145 | <listitem>
|
---|
[de33b2a] | 146 | <para>
|
---|
| 147 | Estimated disk space required: &openjdk-bin-buildsize-x64;
|
---|
| 148 | </para>
|
---|
[784a1a7f] | 149 | </listitem>
|
---|
| 150 | </itemizedlist>
|
---|
[3cd08693] | 151 |
|
---|
| 152 | <bridgehead renderas="sect3">Java Binary Runtime Dependencies</bridgehead>
|
---|
| 153 | <para role="required">
|
---|
[572553b] | 154 | <xref role="runtime" linkend="alsa-lib"/>,
|
---|
| 155 | <xref role="runtime" linkend="cups"/>,
|
---|
| 156 | <xref role="runtime" linkend="giflib"/>, and
|
---|
| 157 | <xref role="runtime" linkend="xorg7-lib"/>
|
---|
[3cd08693] | 158 | </para>
|
---|
[d7df10f3] | 159 |
|
---|
[06d0bed1] | 160 | </sect2>
|
---|
[3cd08693] | 161 |
|
---|
[06d0bed1] | 162 | <sect2 role="installation">
|
---|
| 163 | <title>Installation of the Java BinaryJDK </title>
|
---|
[de33b2a] | 164 | <para>
|
---|
| 165 | Begin by extracting the appropriate binary tarball for your
|
---|
| 166 | architecture and changing to the extracted directory. Install the binary
|
---|
| 167 | <application>OpenJDK</application> with the following commands as the
|
---|
| 168 | <systemitem class="username">root</systemitem> user:
|
---|
| 169 | </para>
|
---|
[784a1a7f] | 170 |
|
---|
[d61ead0a] | 171 | <screen role="root"><userinput>install -vdm755 /opt/OpenJDK-&openjdk-version;+&openjdk-build;-bin &&
|
---|
| 172 | mv -v * /opt/OpenJDK-&openjdk-version;+&openjdk-build;-bin &&
|
---|
| 173 | chown -R root:root /opt/OpenJDK-&openjdk-version;+&openjdk-build;-bin</userinput></screen>
|
---|
[784a1a7f] | 174 |
|
---|
[58cba7f0] | 175 | <para>
|
---|
| 176 | The binary version is now installed. You may create a symlink to that
|
---|
| 177 | version by issuing, as the <systemitem class="username">root</systemitem>
|
---|
| 178 | user:
|
---|
| 179 | </para>
|
---|
| 180 |
|
---|
[d61ead0a] | 181 | <screen role="root"><userinput>ln -sfn OpenJDK-&openjdk-version;+&openjdk-build;-bin /opt/jdk</userinput></screen>
|
---|
[58cba7f0] | 182 |
|
---|
| 183 | <para>
|
---|
| 184 | You may now proceed to <xref linkend="ojdk-conf"/>, where the
|
---|
| 185 | instructions assume that the above link exists.
|
---|
| 186 | </para>
|
---|
[88b2f2ef] | 187 |
|
---|
[784a1a7f] | 188 | </sect2>
|
---|
| 189 |
|
---|
| 190 | </sect1>
|
---|