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