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