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 |
|
---|
7 | <!ENTITY anduin-download "http://anduin.linuxfromscratch.org/files/BLFS/OpenJDK-&openjdk-version;">
|
---|
8 | <!ENTITY openjdk-download-binary-x86 "&anduin-download;/OpenJDK-&openjdk-version;-i686-bin.tar.xz">
|
---|
9 | <!ENTITY openjdk-bin-md5sum-x86 "0dffb64ec1f7bf53e0c51824e6b7ce3e">
|
---|
10 | <!ENTITY openjdk-bin-size-x86 "165 MB">
|
---|
11 | <!ENTITY openjdk-bin-buildsize-x86 "503 MB">
|
---|
12 |
|
---|
13 | <!ENTITY openjdk-download-binary-x64 "&anduin-download;/OpenJDK-&openjdk-version;-x86_64-bin.tar.xz">
|
---|
14 | <!ENTITY openjdk-bin-md5sum-x64 "7da9576cdc154a819a7b6702b67d94b2">
|
---|
15 | <!ENTITY openjdk-bin-size-x64 "142 MB">
|
---|
16 | <!ENTITY openjdk-bin-buildsize-x64 "399 MB">
|
---|
17 | ]>
|
---|
18 |
|
---|
19 | <sect1 id="java" xreflabel="Java-&openjdk-version;">
|
---|
20 | <?dbhtml filename="java.html"?>
|
---|
21 |
|
---|
22 | <sect1info>
|
---|
23 | <othername>$LastChangedBy$</othername>
|
---|
24 | <date>$Date$</date>
|
---|
25 | </sect1info>
|
---|
26 |
|
---|
27 | <title>Java-&openjdk-version;</title>
|
---|
28 |
|
---|
29 | <indexterm zone="java">
|
---|
30 | <primary sortas="a-java">JDK Binary</primary>
|
---|
31 | </indexterm>
|
---|
32 |
|
---|
33 |
|
---|
34 | <sect2>
|
---|
35 | <title>About Java</title>
|
---|
36 | <para>Java is different from most of the packages in LFS and BLFS. It
|
---|
37 | is a programming language that works with files of byte codes to obtain
|
---|
38 | instructions and executes then in a Java Virtual Machine (JVM). An
|
---|
39 | introductory java program looks like:</para>
|
---|
40 |
|
---|
41 | <screen><literal>public class HelloWorld
|
---|
42 | {
|
---|
43 | public static void main(String[] args)
|
---|
44 | {
|
---|
45 | System.out.println("Hello, World");
|
---|
46 | }
|
---|
47 | }</literal></screen>
|
---|
48 |
|
---|
49 | <para>This program is saved as <filename>HelloWorld.java</filename>. The
|
---|
50 | file name, <emphasis>HelloWorld</emphasis>, must match the class name. It
|
---|
51 | is then converted into byte code with
|
---|
52 | <command>javac HelloWorld.java</command>. The output file is
|
---|
53 | <filename>HelloWorld.class</filename>. The program is executed with
|
---|
54 | <command>java HelloWorld</command>. This creates a JVM and runs the
|
---|
55 | code. The 'class' extension must not be specified.</para>
|
---|
56 |
|
---|
57 | <para>Several class files can be combined into one file with the
|
---|
58 | <command>jar</command> command. This is similar to the standard
|
---|
59 | <command>tar</command> command. For instance, the command
|
---|
60 | <command>jar cf myjar.jar *.class</command> will combine all class files
|
---|
61 | in a directory into one jar file. These act as library files.</para>
|
---|
62 |
|
---|
63 | <para>The JVM can search for and use classes in jar files automatically.
|
---|
64 | It uses the <envar>CLASSPATH</envar> environment variable to search for
|
---|
65 | jar files. This is a standard list of colon-separated directory names
|
---|
66 | similar to the <envar>PATH</envar> environment variable.</para>
|
---|
67 |
|
---|
68 | </sect2>
|
---|
69 |
|
---|
70 | <sect2 id="java-bin" xreflabel="Java Binary" role="package">
|
---|
71 | <title>Binary JDK Information</title>
|
---|
72 |
|
---|
73 | <para>Creating a JVM from source requires a set of circular dependencies.
|
---|
74 | The first thing that's needed is a set of programs called a Java Development
|
---|
75 | Kit (JDK). This set of programs includes <command>java</command>,
|
---|
76 | <command>javac</command>, <command>jar</command>, and several others. It
|
---|
77 | also includes several base <emphasis>jar</emphasis> files.</para>
|
---|
78 |
|
---|
79 | <para>To start, we set up a binary installation of the JDK created
|
---|
80 | by the BLFS editors. It is installed in the <filename>/opt</filename>
|
---|
81 | directory to allow for multiple installations, including a source based
|
---|
82 | version.</para>
|
---|
83 |
|
---|
84 | &lfs76_checked;
|
---|
85 |
|
---|
86 | <bridgehead renderas="sect3">Binary Package Information</bridgehead>
|
---|
87 | <itemizedlist spacing="compact">
|
---|
88 | <listitem>
|
---|
89 | <para>Binary download (x86):
|
---|
90 | <ulink url="&openjdk-download-binary-x86;"/></para>
|
---|
91 | </listitem>
|
---|
92 | <listitem>
|
---|
93 | <para>Download MD5 sum: &openjdk-bin-md5sum-x86;</para>
|
---|
94 | </listitem>
|
---|
95 | <listitem>
|
---|
96 | <para>Download size (binary): &openjdk-bin-size-x86;</para>
|
---|
97 | </listitem>
|
---|
98 | <listitem>
|
---|
99 | <para>Estimated disk space required: &openjdk-bin-buildsize-x86;</para>
|
---|
100 | </listitem>
|
---|
101 | </itemizedlist>
|
---|
102 | <itemizedlist spacing="compact">
|
---|
103 | <listitem>
|
---|
104 | <para>Binary download (x86_64):
|
---|
105 | <ulink url="&openjdk-download-binary-x64;"/></para>
|
---|
106 | </listitem>
|
---|
107 | <listitem>
|
---|
108 | <para>Download MD5 sum: &openjdk-bin-md5sum-x64;</para>
|
---|
109 | </listitem>
|
---|
110 | <listitem>
|
---|
111 | <para>Download size (binary): &openjdk-bin-size-x64;</para>
|
---|
112 | </listitem>
|
---|
113 | <listitem>
|
---|
114 | <para>Estimated disk space required: &openjdk-bin-buildsize-x64;</para>
|
---|
115 | </listitem>
|
---|
116 | </itemizedlist>
|
---|
117 |
|
---|
118 | <bridgehead renderas="sect3">Java Binary Runtime Dependencies</bridgehead>
|
---|
119 | <para role="required">
|
---|
120 | <xref linkend="alsa-lib"/>,
|
---|
121 | <xref linkend="atk"/>,
|
---|
122 | <xref linkend="cairo"/>,
|
---|
123 | <xref linkend="cups"/>,
|
---|
124 | <xref linkend="gdk-pixbuf"/>,
|
---|
125 | <xref linkend="giflib"/>,
|
---|
126 | <xref linkend="gtk2"/>,
|
---|
127 | <xref linkend="lcms2"/>, and
|
---|
128 | <xref linkend="xorg7-lib"/>
|
---|
129 | </para>
|
---|
130 |
|
---|
131 | </sect2>
|
---|
132 |
|
---|
133 | <sect2 role="installation">
|
---|
134 | <title>Installation of the Java BinaryJDK </title>
|
---|
135 | <para>Begin by extracting the appropriate binary tarball for your
|
---|
136 | architecture and changing to the extracted directory. Install the binary
|
---|
137 | <application>OpenJDK</application> with the following commands as the
|
---|
138 | <systemitem class="username">root</systemitem> user:</para>
|
---|
139 |
|
---|
140 | <screen role="root"><userinput>install -vdm755 /opt/OpenJDK-&openjdk-version;-bin &&
|
---|
141 | mv -v * /opt/OpenJDK-&openjdk-version;-bin &&
|
---|
142 | chown -R root:root /opt/OpenJDK-&openjdk-version;-bin</userinput></screen>
|
---|
143 |
|
---|
144 | <para>Configure the temporary <application>OpenJDK</application>
|
---|
145 | installation by issuing the following commands (note that if you logout
|
---|
146 | and login back before having definitely configured
|
---|
147 | <xref linkend='openjdk'/>, you'll have to issue them again):</para>
|
---|
148 |
|
---|
149 | <screen><userinput>export CLASSPATH=.:/usr/share/java &&
|
---|
150 | export JAVA_HOME=/opt/OpenJDK-&openjdk-version;-bin &&
|
---|
151 | export PATH="$PATH:/opt/OpenJDK-&openjdk-version;-bin/bin"</userinput></screen>
|
---|
152 |
|
---|
153 | <para>You may also include those instructions into a file in the <filename
|
---|
154 | class="directory">/etc/profile.d</filename> directory. Do not forget to
|
---|
155 | logout and login back, or to source the profile file after
|
---|
156 | modification.</para>
|
---|
157 |
|
---|
158 |
|
---|
159 | <para>The binary version is now installed. If you don't want to compile the
|
---|
160 | sources, skip ahead to the <xref linkend='openjdk-config'/> section.
|
---|
161 | Otherwise, continue to the <xref linkend='apache-ant'/>,
|
---|
162 | <xref linkend='junit'/>, and <xref linkend='openjdk'/> sections.</para>
|
---|
163 |
|
---|
164 | </sect2>
|
---|
165 |
|
---|
166 | </sect1>
|
---|