[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. -->
|
---|
[a29486e4] | 9 | <!ENTITY anduin-download "&sources-anduin-http;/OpenJDK/OpenJDK-&openjdk-version;">
|
---|
[d53d455] | 10 | <!ENTITY openjdk-download-binary-x86 "&sources-anduin-http;/OpenJDK/OpenJDK-16.0.2/OpenJDK-16.0.2+7-i686-bin.tar.xz">
|
---|
| 11 | <!ENTITY openjdk-bin-md5sum-x86 "45410ad7ec9045c379f9e736488696c3">
|
---|
| 12 | <!ENTITY openjdk-bin-size-x86 "152 MB">
|
---|
| 13 | <!ENTITY openjdk-bin-buildsize-x86 "29 MB">
|
---|
[784a1a7f] | 14 |
|
---|
[fedac85] | 15 | <!-- Not uploaded to anduin, since this file is now available under GNU GPLv2
|
---|
| 16 | licence.-->
|
---|
[df48c56] | 17 | <!-- Reuploaded to anduin due to the complexity of the download URL, per Bruce's
|
---|
| 18 | request. - Doug -->
|
---|
| 19 | <!ENTITY openjdk-download-binary-x64 "&sources-anduin-http;/OpenJDK/OpenJDK-&openjdk-version;/openjdk-&openjdk-version;_linux-x64_bin.tar.gz">
|
---|
[d53d455] | 20 | <!ENTITY openjdk-bin-md5sum-x64 "31c344e9097bd034c892b97c5ac45c27">
|
---|
| 21 | <!ENTITY openjdk-bin-size-x64 "176 MB">
|
---|
| 22 | <!ENTITY openjdk-bin-buildsize-x64 "303 MB">
|
---|
[784a1a7f] | 23 | ]>
|
---|
| 24 |
|
---|
[88b2f2ef] | 25 | <sect1 id="java" xreflabel="Java-&openjdk-version;">
|
---|
[784a1a7f] | 26 | <?dbhtml filename="java.html"?>
|
---|
| 27 |
|
---|
| 28 | <sect1info>
|
---|
| 29 | <date>$Date$</date>
|
---|
| 30 | </sect1info>
|
---|
| 31 |
|
---|
[d7df10f3] | 32 | <title>Java-&openjdk-version;</title>
|
---|
[784a1a7f] | 33 |
|
---|
| 34 | <indexterm zone="java">
|
---|
| 35 | <primary sortas="a-java">JDK Binary</primary>
|
---|
| 36 | </indexterm>
|
---|
| 37 |
|
---|
| 38 |
|
---|
[d7df10f3] | 39 | <sect2>
|
---|
| 40 | <title>About Java</title>
|
---|
[de33b2a] | 41 | <para>
|
---|
| 42 | Java is different from most of the packages in LFS and BLFS. It
|
---|
| 43 | is a programming language that works with files of byte codes to obtain
|
---|
[d53d455] | 44 | instructions and executes them in a Java Virtual Machine (JVM). An
|
---|
[de33b2a] | 45 | introductory java program looks like:
|
---|
| 46 | </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 |
|
---|
[de33b2a] | 56 | <para>
|
---|
| 57 | This program is saved as <filename>HelloWorld.java</filename>. The
|
---|
| 58 | file name, <emphasis>HelloWorld</emphasis>, must match the class name.
|
---|
| 59 | It is then converted into byte code with
|
---|
| 60 | <command>javac HelloWorld.java</command>. The output file is
|
---|
| 61 | <filename>HelloWorld.class</filename>. The program is executed with
|
---|
| 62 | <command>java HelloWorld</command>. This creates a JVM and runs the
|
---|
| 63 | code. The 'class' extension must not be specified.
|
---|
| 64 | </para>
|
---|
| 65 |
|
---|
| 66 | <para>
|
---|
| 67 | Several class files can be combined into one file with the
|
---|
| 68 | <command>jar</command> command. This is similar to the standard
|
---|
| 69 | <command>tar</command> command. For instance, the command
|
---|
| 70 | <command>jar cf myjar.jar *.class</command> will combine all class files
|
---|
| 71 | in a directory into one jar file. These act as library files.
|
---|
| 72 | </para>
|
---|
| 73 |
|
---|
| 74 | <para>
|
---|
| 75 | The JVM can search for and use classes in jar files automatically.
|
---|
| 76 | It uses the <envar>CLASSPATH</envar> environment variable to search for
|
---|
| 77 | jar files. This is a standard list of colon-separated directory names
|
---|
| 78 | similar to the <envar>PATH</envar> environment variable.
|
---|
| 79 | </para>
|
---|
[f3429309] | 80 |
|
---|
[d7df10f3] | 81 | </sect2>
|
---|
[784a1a7f] | 82 |
|
---|
[06d0bed1] | 83 | <sect2 id="java-bin" xreflabel="Java Binary" role="package">
|
---|
| 84 | <title>Binary JDK Information</title>
|
---|
[784a1a7f] | 85 |
|
---|
[de33b2a] | 86 | <para>
|
---|
| 87 | Creating a JVM from source requires a set of circular dependencies.
|
---|
| 88 | The first thing that's needed is a set of programs called a Java
|
---|
| 89 | Development Kit (JDK). This set of programs includes
|
---|
| 90 | <command>java</command>, <command>javac</command>,
|
---|
| 91 | <command>jar</command>, and several others. It also includes several
|
---|
| 92 | base <emphasis>jar</emphasis> files.
|
---|
| 93 | </para>
|
---|
[784a1a7f] | 94 |
|
---|
[de33b2a] | 95 | <para>
|
---|
| 96 | To start, we set up a binary installation of the JDK created
|
---|
| 97 | by the BLFS editors. It is installed in the <filename>/opt</filename>
|
---|
| 98 | directory to allow for multiple installations, including a source based
|
---|
| 99 | version.
|
---|
| 100 | </para>
|
---|
[784a1a7f] | 101 |
|
---|
[ef0722a] | 102 | &lfs110_checked;
|
---|
[d7df10f3] | 103 |
|
---|
[784a1a7f] | 104 | <bridgehead renderas="sect3">Binary Package Information</bridgehead>
|
---|
| 105 | <itemizedlist spacing="compact">
|
---|
| 106 | <listitem>
|
---|
[de33b2a] | 107 | <para>
|
---|
| 108 | Binary download (x86): <ulink url="&openjdk-download-binary-x86;"/>
|
---|
| 109 | </para>
|
---|
[784a1a7f] | 110 | </listitem>
|
---|
| 111 | <listitem>
|
---|
[de33b2a] | 112 | <para>
|
---|
| 113 | Download MD5 sum: &openjdk-bin-md5sum-x86;
|
---|
| 114 | </para>
|
---|
[784a1a7f] | 115 | </listitem>
|
---|
| 116 | <listitem>
|
---|
[de33b2a] | 117 | <para>
|
---|
| 118 | Download size (binary): &openjdk-bin-size-x86;
|
---|
| 119 | </para>
|
---|
[784a1a7f] | 120 | </listitem>
|
---|
| 121 | <listitem>
|
---|
[de33b2a] | 122 | <para>
|
---|
| 123 | Estimated disk space required: &openjdk-bin-buildsize-x86;
|
---|
| 124 | </para>
|
---|
[784a1a7f] | 125 | </listitem>
|
---|
| 126 | </itemizedlist>
|
---|
| 127 | <itemizedlist spacing="compact">
|
---|
| 128 | <listitem>
|
---|
[de33b2a] | 129 | <para>
|
---|
| 130 | Binary download (x86_64): <ulink url="&openjdk-download-binary-x64;"/>
|
---|
| 131 | </para>
|
---|
[784a1a7f] | 132 | </listitem>
|
---|
| 133 | <listitem>
|
---|
[de33b2a] | 134 | <para>
|
---|
| 135 | Download MD5 sum: &openjdk-bin-md5sum-x64;
|
---|
| 136 | </para>
|
---|
[784a1a7f] | 137 | </listitem>
|
---|
| 138 | <listitem>
|
---|
[de33b2a] | 139 | <para>
|
---|
| 140 | Download size (binary): &openjdk-bin-size-x64;
|
---|
| 141 | </para>
|
---|
[784a1a7f] | 142 | </listitem>
|
---|
| 143 | <listitem>
|
---|
[de33b2a] | 144 | <para>
|
---|
| 145 | Estimated disk space required: &openjdk-bin-buildsize-x64;
|
---|
| 146 | </para>
|
---|
[784a1a7f] | 147 | </listitem>
|
---|
| 148 | </itemizedlist>
|
---|
[3cd08693] | 149 |
|
---|
| 150 | <bridgehead renderas="sect3">Java Binary Runtime Dependencies</bridgehead>
|
---|
| 151 | <para role="required">
|
---|
[572553b] | 152 | <xref role="runtime" linkend="alsa-lib"/>,
|
---|
| 153 | <xref role="runtime" linkend="cups"/>,
|
---|
| 154 | <xref role="runtime" linkend="giflib"/>, and
|
---|
| 155 | <xref role="runtime" linkend="xorg7-lib"/>
|
---|
[3cd08693] | 156 | </para>
|
---|
[d7df10f3] | 157 |
|
---|
[06d0bed1] | 158 | </sect2>
|
---|
[3cd08693] | 159 |
|
---|
[06d0bed1] | 160 | <sect2 role="installation">
|
---|
| 161 | <title>Installation of the Java BinaryJDK </title>
|
---|
[0b1f0d0] | 162 |
|
---|
| 163 | <note>
|
---|
| 164 | <para>
|
---|
| 165 | The tarball
|
---|
| 166 | <emphasis>openjdk-&openjdk-version;_linux-x64_bin.tar.gz</emphasis> will
|
---|
| 167 | untar to the <emphasis>jdk-&openjdk-version;</emphasis> directory.
|
---|
| 168 | </para>
|
---|
| 169 | </note>
|
---|
| 170 |
|
---|
[de33b2a] | 171 | <para>
|
---|
| 172 | Begin by extracting the appropriate binary tarball for your
|
---|
| 173 | architecture and changing to the extracted directory. Install the binary
|
---|
| 174 | <application>OpenJDK</application> with the following commands as the
|
---|
| 175 | <systemitem class="username">root</systemitem> user:
|
---|
| 176 | </para>
|
---|
[784a1a7f] | 177 |
|
---|
[50a6bd6] | 178 | <screen role="root"><userinput>install -vdm755 /opt/OpenJDK-&openjdk-version;-bin &&
|
---|
| 179 | mv -v * /opt/OpenJDK-&openjdk-version;-bin &&
|
---|
| 180 | chown -R root:root /opt/OpenJDK-&openjdk-version;-bin</userinput></screen>
|
---|
[784a1a7f] | 181 |
|
---|
[58cba7f0] | 182 | <para>
|
---|
| 183 | The binary version is now installed. You may create a symlink to that
|
---|
| 184 | version by issuing, as the <systemitem class="username">root</systemitem>
|
---|
| 185 | user:
|
---|
| 186 | </para>
|
---|
| 187 |
|
---|
[50a6bd6] | 188 | <screen role="root"><userinput>ln -sfn OpenJDK-&openjdk-version;-bin /opt/jdk</userinput></screen>
|
---|
[58cba7f0] | 189 |
|
---|
| 190 | <para>
|
---|
| 191 | You may now proceed to <xref linkend="ojdk-conf"/>, where the
|
---|
| 192 | instructions assume that the above link exists.
|
---|
| 193 | </para>
|
---|
[88b2f2ef] | 194 |
|
---|
[784a1a7f] | 195 | </sect2>
|
---|
| 196 |
|
---|
| 197 | </sect1>
|
---|