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