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