/[gentoo]/xml/htdocs/doc/en/java.xml
Gentoo

Contents of /xml/htdocs/doc/en/java.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.21 - (show annotations) (download) (as text)
Mon Dec 12 12:00:43 2005 UTC (9 years ago) by neysx
Branch: MAIN
Changes since 1.20: +4 -3 lines
File MIME type: application/xml
#115240 Add link to /proj/en/java/

1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/java.xml,v 1.20 2005/11/13 12:17:36 alin Exp $ -->
3 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
4
5 <guide link="/doc/en/java.xml">
6 <title>Gentoo Java Guide</title>
7
8 <author title="Author and Editor">
9 <mail link="karltk@gentoo.org">Karl Trygve Kalleberg</mail>
10 </author>
11 <author title="Editor">
12 <mail link="swift@gentoo.org">Sven Vermeulen</mail>
13 </author>
14 <author title="Editor">
15 <mail link="vanquirius@gentoo.org">Marcelo Góes</mail>
16 </author>
17
18 <abstract>
19 This guide will introduce users and developers to Java and explain how to use
20 Java with Gentoo Linux.
21 </abstract>
22
23 <license/>
24
25 <version>0.2</version>
26 <date>2005-12-12</date>
27
28 <chapter>
29 <title>What is Java?</title>
30 <section>
31 <title>Overview</title>
32 <body>
33
34 <p>
35 Java is a programming language developed by engineers of Sun Microsystems.
36 The language is object-oriented and designed to run on multiple platforms
37 without the need of recompiling code for each platform. Although Java can
38 be compiled as a native program, much of Java's popularity can be attributed
39 to its portability, along with other features such as garbage collection.
40 The ability to compile once and run in various platforms is achieved through
41 the use of just-in-time compilers (JIT), which compile Java bytecodes into
42 native code when a given program is run.
43 </p>
44
45 <p>
46 In order to run Java bytecodes, one needs to have a JRE (Java Runtime Environment)
47 installed. A JRE provides core libraries, a platform dependent Java Virtual Machine,
48 plug-ins for browsers, among other things. A JDK (Java Development Kit) adds
49 programming tools, such as a bytecode compiler and a debugger.
50 </p>
51
52 </body>
53 </section>
54 </chapter>
55
56 <chapter>
57 <title>Installing a JRE/JDK</title>
58 <section>
59 <title>The choices</title>
60 <body>
61
62 <p>
63 Gentoo provides numerous JREs and JDKs. Among the current alternatives, we have:
64 </p>
65
66 <ul>
67 <li>blackdown-jre and blackdown-jdk, the Blackdown Java Kit</li>
68 <li>sun-jre-bin and sun-jdk, Sun's Java Kit </li>
69 <li>ibm-jre-bin and ibm-jdk-bin, the IBM Java Kit</li>
70 <li>compaq-jre and compaq-jdk, the Compaq Java Kit for Alpha/Linux/GNU</li>
71 <li>jrockit-jdk-bin, BEA WebLogic's J2SE Development Kit</li>
72 </ul>
73
74 <p>
75 The default is the Blackdown JRE/JDK
76 pair, as it is freely ("free as in beer") available without any registration
77 fuss.
78 </p>
79
80 <p>
81 Both the Sun JRE/JDK and the IBM JRE/JDK are generally faster, but getting them
82 is a bit more work, as you are required to read and accept their license before
83 downloading (IBM additionally requires you to register).
84 </p>
85
86 <p>
87 Our ebuilds for the Sun and IBM JRE/JDKs will notify you of where to go to
88 download them.
89 </p>
90
91 </body>
92 </section>
93 <section>
94 <title>Installing the Sun/IBM JRE/JDKs</title>
95 <body>
96
97 <p>
98 If you run <c>emerge =sun-jdk-1.4.2.06</c> or <c>=ibm-jdk-bin-1.4.2</c>, you will
99 be notified that you are required to download the actual tarballs yourself. This
100 has to do with license restrictions for the Sun JRE/JDK (online click-wrap
101 license) and registration issues with the IBM JRE/JDK.
102 </p>
103
104 <note>
105 ibm-jdk-bin is currently masked, you may have to unmask it to use it.
106 </note>
107
108 <p>
109 You should download the indicated file(s) into
110 <path>/usr/portage/distfiles</path>. Once that is done, you can rerun the emerge
111 command, then the JRE/JDK will be installed properly into <path>/opt</path>.
112 </p>
113
114 </body>
115 </section>
116 </chapter>
117
118 <chapter>
119 <title>Configuring your JRE/JDK</title>
120 <section>
121 <title>Overview</title>
122 <body>
123
124 <p>
125 Gentoo has the ability to have multiple JDKs and JREs installed without them
126 conflicting.
127 </p>
128
129 <p>
130 Using the <c>java-config</c> tool, you can set the system-wide default if you
131 have root access. Users can also use <c>java-config</c> to set up their own
132 personal default, that is different from the system-wide default.
133 </p>
134
135 </body>
136 </section>
137
138 <section>
139 <title>Setting a default JRE/JDK</title>
140 <body>
141
142 <p>
143 Running the command <c>java-config --list-available-vms</c> will give you a list
144 of all available JREs and JDKs on your system. Here is an example of output:
145 </p>
146
147 <pre caption="Listing available VMs">
148 # <i>java-config --list-available-vms</i>
149 [blackdown-jdk-1.3.1] Blackdown JDK 1.3.1 (/etc/env.d/java/20blackdown-jdk-1.3.1)
150 [blackdown-jre-1.3.1] Blackdown JRE 1.3.1 (/etc/env.d/java/20blackdown-jre-1.3.1)
151 [ibm-jdk-1.3.0] IBM JDK 1.3.0 (/etc/env.d/java/20ibm-jdk-1.3.0)
152 [ibm-jdk-1.3.1] IBM JDK 1.3.1 (/etc/env.d/java/20ibm-jdk-1.3.1)
153 [ibm-jre-1.3.1] IBM JRE 1.3.1 (/etc/env.d/java/20ibm-jre-1.3.1)
154 [sun-jdk-1.4.0] Sun JDK 1.4.0 (/etc/env.d/java/20sun-jdk-1.4.0)
155 </pre>
156
157 <p>
158 The name in the brackets <path>"[]"</path> is the handle or ID for that
159 particular VM. You use pass that ID to <c>java-config --set-system-vm</c>. Here is
160 an example of how to set the system VM.
161 </p>
162
163 <pre caption="Setting the System VM">
164 # <i>java-config --set-system-vm=ibm-jdk-1.3.1</i>
165 Now using IBM JDK 1.3.1 (/etc/env.d/java/20ibm-jdk-1.3.1)
166 </pre>
167
168 <note>
169 You will have to be root to run --set-system-vm.
170 </note>
171
172 <p>
173 Once you have issued <c>java-config --set-system-vm</c> with a particular VM
174 ID, you will need to regenerate your <path>/etc/profile.env</path>. You can do
175 it like this:
176 </p>
177
178 <pre caption="Regenerating /etc/profile.env" >
179 # <i>env-update</i>
180 </pre>
181
182 <p>
183 After this, you will either want to relogin, or resource
184 <path>/etc/profile</path> into your environment.
185 </p>
186
187 <p>
188 As a regular user, you can use <c>java-config --set-user-vm</c>, which will
189 create <path>~/.gentoo/java-env</path> with all required env vars. You would
190 normally source this from your shell's startup script (generally
191 <path>~/.bashrc</path>).
192 </p>
193
194 </body>
195 </section>
196 </chapter>
197
198 <chapter>
199 <title>USE flags for use with Java</title>
200 <section>
201 <title>Setting USE flags</title>
202 <body>
203
204 <p>
205 For more information regarding USE flags, refer to the <uri
206 link="/doc/en/handbook/handbook-x86.xml?part=2&amp;chap=2">USE flags</uri>
207 chapter from the Gentoo Handbook.
208 </p>
209
210 </body>
211 </section>
212 <section>
213 <title>The flags</title>
214 <body>
215
216 <ul>
217 <li>The <b>java</b> flag adds support for Java in a variety of programs.</li>
218 <li>
219 The <b>nsplugin</b> flag adds a symlink to the javaplugin for
220 Mozilla-like browsers (including Firefox) if you are using, for example,
221 Blackdown's Java kit, IBM Java Kit or Sun's Java Kit. You will need this
222 for viewing Java applets in your Mozilla-like browser.
223 </li>
224 </ul>
225
226 </body>
227 </section>
228 </chapter>
229
230 <chapter>
231 <title>Additional resources</title>
232 <section>
233 <title>Off-line resources</title>
234 <body>
235
236 <ul>
237 <li>java-config man page</li>
238 <li><c>java-config --help</c></li>
239 <li>The <path>/usr/bin/java-config</path> script itself</li>
240 </ul>
241
242 </body>
243 </section>
244 <section>
245 <title>Online resources</title>
246 <body>
247
248 <ul>
249 <li>The <uri link="/proj/en/java/">Gentoo Java Project Page</uri></li>
250 <li>
251 The <uri
252 link="http://news.gmane.org/gmane.linux.gentoo.devel">gentoo-dev</uri>,
253 <uri link="http://news.gmane.org/gmane.linux.gentoo.user">gentoo-user
254 </uri> and <uri
255 link="http://news.gmane.org/gmane.linux.gentoo.java">gentoo-java</uri>
256 mailing list archives
257 </li>
258 <li>#gentoo and #gentoo-java on irc.freenode.net</li>
259 <li>
260 <uri
261 link="http://en.wikipedia.org/wiki/Java_programming_language">Wikipedia's
262 entry for Java</uri>
263 </li>
264 </ul>
265
266 </body>
267 </section>
268 </chapter>
269 </guide>

  ViewVC Help
Powered by ViewVC 1.1.20