Lines 2-9
Link Here
|
2 |
<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/java.xml,v 1.15 2005/03/23 13:40:23 swift Exp $ --> |
2 |
<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/java.xml,v 1.15 2005/03/23 13:40:23 swift Exp $ --> |
3 |
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
3 |
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
4 |
|
4 |
|
5 |
<guide link="/doc/en/java-user.xml"> |
5 |
<guide link="/doc/en/java.xml"> |
6 |
<title>Gentoo Java User Guide</title> |
6 |
<title>Gentoo Java Guide</title> |
7 |
|
7 |
|
8 |
<author title="Author"> |
8 |
<author title="Author"> |
9 |
<mail link="karltk@gentoo.org">Karl Trygve Kalleberg</mail> |
9 |
<mail link="karltk@gentoo.org">Karl Trygve Kalleberg</mail> |
Lines 11-16
Link Here
|
11 |
<author title="Author"> |
11 |
<author title="Author"> |
12 |
<mail link="nichoj@gentoo.org">Joshua Nichols</mail> |
12 |
<mail link="nichoj@gentoo.org">Joshua Nichols</mail> |
13 |
</author> |
13 |
</author> |
|
|
14 |
<author title="Editor"> |
15 |
<mail link="nightmorph@gentoo.org">Joshua Saddler</mail> |
16 |
</author> |
14 |
|
17 |
|
15 |
<abstract> |
18 |
<abstract> |
16 |
This guide will introduce you to Java and explain how to use Java with Gentoo |
19 |
This guide will introduce you to Java and explain how to use Java with Gentoo |
Lines 21-28
Link Here
|
21 |
<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
24 |
<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
22 |
<license/> |
25 |
<license/> |
23 |
|
26 |
|
24 |
<version>0.1.8</version> |
27 |
<version>0.4</version> |
25 |
<date>2006-05-16</date> |
28 |
<date>2006-06-24</date> |
26 |
|
29 |
|
27 |
<chapter> |
30 |
<chapter> |
28 |
<title>What is Java?</title> |
31 |
<title>What is Java?</title> |
Lines 35-45
Link Here
|
35 |
language is object-oriented and designed to run on multiple platforms without |
38 |
language is object-oriented and designed to run on multiple platforms without |
36 |
the need of recompiling code for each platform. Although Java can be compiled |
39 |
the need of recompiling code for each platform. Although Java can be compiled |
37 |
as a native program, much of Java's popularity can be attributed to its |
40 |
as a native program, much of Java's popularity can be attributed to its |
38 |
portability, along with other features such as garbage collection. |
41 |
portability, along with other features such as garbage collection. To make |
39 |
To make platform independence possible the Java compiler compiles the Java |
42 |
platform independence possible the Java compiler compiles the Java code to an |
40 |
code to an intermediate representation called "Java bytecode" that runs on a |
43 |
intermediate representation called "Java bytecode" that runs on a JRE (Java |
41 |
JRE (Java Runtime Environment) and not directly on the operating system. |
44 |
Runtime Environment) and not directly on the operating system. is a JRE for |
42 |
is a JRE for each supported OS that runs natively on the OS. |
45 |
each supported OS that runs natively on the OS. |
43 |
</p> |
46 |
</p> |
44 |
|
47 |
|
45 |
<p> |
48 |
<p> |
Lines 104-121
Link Here
|
104 |
--> |
107 |
--> |
105 |
|
108 |
|
106 |
<p> |
109 |
<p> |
107 |
The default is Blackdown for both the JRE and the JDK , as it is freely ("free as in beer") |
110 |
The default is Blackdown for both the JRE and the JDK, as it is freely ("free |
108 |
available without any registration fuss. |
111 |
as in beer") available without any registration fuss. |
109 |
</p> |
112 |
</p> |
110 |
|
113 |
|
111 |
<p> |
114 |
<p> |
112 |
Both the Sun and the IBM are generally faster, but getting them |
115 |
Both the Sun and the IBM are generally faster, but getting them is a bit more |
113 |
is a bit more hassle, as you are required to read and accept their license before |
116 |
hassle, as you are required to read and accept their license before downloading |
114 |
downloading (IBM additionally requires you to register). |
117 |
(IBM additionally requires you to register). |
115 |
</p> |
118 |
</p> |
116 |
|
119 |
|
117 |
<p> |
120 |
<p> |
118 |
Our ebuilds for the Sun and IBM JRE/JDKs will inform you how to download the appropriate files. |
121 |
Our ebuilds for the Sun and IBM JRE/JDKs will inform you how to download the |
|
|
122 |
appropriate files. |
119 |
</p> |
123 |
</p> |
120 |
|
124 |
|
121 |
</body> |
125 |
</body> |
Lines 125-136
Link Here
|
125 |
<body> |
129 |
<body> |
126 |
|
130 |
|
127 |
<p> |
131 |
<p> |
128 |
To install your profile's default JDK, you can run <c>emerge virtual/jdk</c> |
132 |
To install your profile's default JDK, you can run <c>emerge virtual/jdk</c>. |
129 |
. Or to install your profile's default JRE, you can <c>emerge virtual/jre</c>. |
133 |
Or to install your profile's default JRE, you can <c>emerge virtual/jre</c>. |
130 |
</p> |
134 |
</p> |
131 |
|
135 |
|
132 |
<note> |
136 |
<note> |
133 |
A JDK also includes a JRE, so if you install a JDK you shouldn't have to also |
137 |
A JDK also includes a JRE, so if you install a JDK you shouldn't have to also |
134 |
have to install a JRE. |
138 |
have to install a JRE. |
135 |
</note> |
139 |
</note> |
136 |
|
140 |
|
Lines 150-157
Link Here
|
150 |
|
154 |
|
151 |
<p> |
155 |
<p> |
152 |
You should download the indicated file(s) into |
156 |
You should download the indicated file(s) into |
153 |
<path>/usr/portage/distfiles</path>. Once there, you can rerun the |
157 |
<path>/usr/portage/distfiles</path>. Once there, you can rerun the emerge |
154 |
emerge command, at which point the JRE/JDK will be begin to install. |
158 |
command, at which point the JRE/JDK will be begin to install. |
155 |
</p> |
159 |
</p> |
156 |
|
160 |
|
157 |
</body> |
161 |
</body> |
Lines 165-177
Link Here
|
165 |
<body> |
169 |
<body> |
166 |
|
170 |
|
167 |
<p> |
171 |
<p> |
168 |
Gentoo has the ability to have multiple JDKs and JREs installed without causing conflicts. |
172 |
Gentoo has the ability to have multiple JDKs and JREs installed without causing |
|
|
173 |
conflicts. |
169 |
</p> |
174 |
</p> |
170 |
|
175 |
|
171 |
<p> |
176 |
<p> |
172 |
Using the <c>java-config</c> tool, you can set the system-wide default (provided you have |
177 |
Using the <c>java-config</c> tool, you can set the system-wide default |
173 |
root access). Users can also use <c>java-config</c> to set up their own |
178 |
(provided you have root access). Users can also use <c>java-config</c> to set |
174 |
personal default. |
179 |
up their own personal default. |
175 |
</p> |
180 |
</p> |
176 |
|
181 |
|
177 |
<note> |
182 |
<note> |
Lines 208-233
Link Here
|
208 |
</pre> |
213 |
</pre> |
209 |
|
214 |
|
210 |
<p> |
215 |
<p> |
211 |
The <e>*</e> indicated this is the current active vm (system-vm or user-vm when |
216 |
The <e>*</e> indicates this is the current active vm (system-vm or user-vm when |
212 |
set). The name in the brackets <e>"[]"</e> is the handle or ID for that |
217 |
set). The name in the brackets (<e>[]</e>) is the handle or ID for that |
213 |
particular VM. You use the handle or the number to <c>java-config |
218 |
particular VM. You use the handle or the number to <c>java-config |
214 |
--set-system-vm</c>. Here is an example of how to set the system VM. |
219 |
--set-system-vm</c>. Here is an example of how to set the system VM. |
215 |
</p> |
220 |
</p> |
216 |
|
221 |
|
217 |
<pre caption="Setting the System VM"> |
222 |
<pre caption="Setting the System VM"> |
218 |
<comment>By handle (preferred)</comment> |
223 |
<comment>(By handle (preferred))</comment> |
219 |
# <i>java-config --set-system-vm blackdown-jdk-1.4</i> |
224 |
# <i>java-config --set-system-vm blackdown-jdk-1.4</i> |
220 |
<comment>By number</comment> |
225 |
<comment>(By number)</comment> |
221 |
# <i>java-config --set-system-vm 2</i> |
226 |
# <i>java-config --set-system-vm 2</i> |
222 |
</pre> |
227 |
</pre> |
223 |
|
228 |
|
224 |
<p> |
229 |
<p> |
225 |
As a regular user, you can use <c>java-config --set-user-vm</c> |
230 |
As a regular user, you can use <c>java-config --set-user-vm</c>. |
226 |
</p> |
231 |
</p> |
227 |
|
232 |
|
228 |
<note> |
233 |
<note> |
229 |
You no longer have to <c>source</c> the profile for updates to the |
234 |
You no longer have to <c>source</c> the profile for updates to the user/system |
230 |
user/system VM take place. |
235 |
VM take place. |
231 |
</note> |
236 |
</note> |
232 |
|
237 |
|
233 |
</body> |
238 |
</body> |
Lines 242-275
Link Here
|
242 |
|
247 |
|
243 |
<p> |
248 |
<p> |
244 |
Because of the wide variety of available VMs, we do not have the resources to |
249 |
Because of the wide variety of available VMs, we do not have the resources to |
245 |
test and verify every package works on all of them. So to ensure that every |
250 |
test and verify every package works on all of them. So to ensure that every |
246 |
packages merges smoothly, we have defined a list of <e>default / supported |
251 |
packages merges smoothly, we have defined a list of <e>default/supported |
247 |
vms</e> per arch. You can find them in |
252 |
VMs</e> per arch. You can find them in |
248 |
<path>/usr/share/java-config/config/jdk-defaults.conf</path>. When you are |
253 |
<path>/usr/share/java-config/config/jdk-defaults.conf</path>. When you are |
249 |
merging a Java package, and it detects one of the VM in that file is installed, |
254 |
merging a Java package, and it detects one of the VM in that file is installed, |
250 |
it will automatically use that VM, instead of the system-vm. |
255 |
it will automatically use that VM, instead of the system-vm. |
251 |
</p> |
256 |
</p> |
252 |
|
257 |
|
253 |
<p> |
258 |
<p> |
254 |
The merge time VM switching is also needed when, for example, your system-vm is |
259 |
The merge time VM switching is also needed when, for example, your system-vm is |
255 |
set a 1.4 VM and the package you are merging requires a 1.5 VM. While merging |
260 |
set a 1.4 VM and the package you are merging requires a 1.5 VM. While merging |
256 |
it will use the preferred 1.5 Vm, leaving your system-vm choice intact. |
261 |
it will use the preferred 1.5 VM, leaving your system-vm choice intact. |
257 |
</p> |
262 |
</p> |
258 |
|
263 |
|
259 |
<p> |
264 |
<p> |
260 |
Of course, Gentoo is all about choice, so you can override these defaults in |
265 |
Of course, Gentoo is all about choice, so you can override these defaults in |
261 |
<path>/etc/java-config-2/build/jdk.conf</path> and have complete control over which VM |
266 |
<path>/etc/java-config-2/build/jdk.conf</path> and have complete control over |
262 |
will get used.<br/> |
267 |
which VM will get used. Some examples: |
263 |
Some examples: |
|
|
264 |
</p> |
268 |
</p> |
265 |
|
269 |
|
266 |
<pre caption="Example /etc/java-config-2/build/jdk.conf"> |
270 |
<pre caption="Example /etc/java-config-2/build/jdk.conf"> |
267 |
<comment># I Always want it to use a sun-jdk, ie sun-jdk-1.4 for 1.4, sun-jdk-1.5 for 1.5, etc</comment> |
271 |
<comment>(I always want it to use a sun-jdk, ie sun-jdk-1.4 for 1.4, sun-jdk-1.5 for 1.5, etc)</comment> |
268 |
*=sun-jdk |
272 |
*=sun-jdk |
269 |
</pre> |
273 |
</pre> |
270 |
|
274 |
|
271 |
<pre caption="Example /etc/java-config-2/build/jdk.conf"> |
275 |
<pre caption="Example /etc/java-config-2/build/jdk.conf"> |
272 |
<comment># Always use sun-jdk-1.5 wherever possible (except for when a 1.4 or 1.3 VM is explicitly required</comment> |
276 |
<comment>(Always use sun-jdk-1.5 wherever possible, except for when a 1.4 or 1.3 VM is explicitly required)</comment> |
273 |
*=sun-jdk-1.5 |
277 |
*=sun-jdk-1.5 |
274 |
</pre> |
278 |
</pre> |
275 |
|
279 |
|
Lines 281-291
Link Here
|
281 |
1.5=sun-jdk |
285 |
1.5=sun-jdk |
282 |
</pre> |
286 |
</pre> |
283 |
|
287 |
|
284 |
|
|
|
285 |
<warn> |
288 |
<warn> |
286 |
You do not have to edit this file. If you change these options to use a |
289 |
You do not have to edit this file. If you change these options to use a |
287 |
unsupported VM, things could possibly break. Bugs reported with a |
290 |
unsupported VM, things could possibly break. Bugs reported with a unsupported |
288 |
unsupported VM will a lower priority if they aren't present with supported VMs. |
291 |
VM will a lower priority if they aren't present with supported VMs. |
289 |
</warn> |
292 |
</warn> |
290 |
|
293 |
|
291 |
</body> |
294 |
</body> |
Lines 297-312
Link Here
|
297 |
<warn> |
300 |
<warn> |
298 |
The options explained in this section should be considered deprecated and will |
301 |
The options explained in this section should be considered deprecated and will |
299 |
be most likely be removed in the future. We strongly recommend against using |
302 |
be most likely be removed in the future. We strongly recommend against using |
300 |
these, because your Java projects or application should ideally manage their own classpaths. If you choose to specify a default CLASSPATH, some applications may behave unexpectedly, because classes they weren't expecting would be on the classpath. |
303 |
these, because your Java projects or application should ideally manage their |
|
|
304 |
own classpaths. If you choose to specify a default CLASSPATH, some applications |
305 |
may behave unexpectedly, because classes they weren't expecting would be on the |
306 |
classpath. |
301 |
</warn> |
307 |
</warn> |
302 |
|
308 |
|
303 |
<p> |
309 |
<p> |
304 |
<c>java-config</c> can also be used to set a system-wide default CLASSPATH, as well a user-specific default CLASSPATH. |
310 |
<c>java-config</c> can also be used to set a system-wide default CLASSPATH, as |
|
|
311 |
well a user-specific default CLASSPATH. |
305 |
</p> |
312 |
</p> |
306 |
|
313 |
|
307 |
<p> |
314 |
<p> |
308 |
First, you will want to list available Java libraries installed on your system that might want to be put in your CLASSPATH.<br/> |
315 |
First, you will want to list available Java libraries installed on your system |
309 |
Here is an example of output: |
316 |
that might want to be put in your CLASSPATH. Here is an example of output: |
310 |
</p> |
317 |
</p> |
311 |
|
318 |
|
312 |
<pre caption="Listing classes"> |
319 |
<pre caption="Listing classes"> |
Lines 320-328
Link Here
|
320 |
</pre> |
327 |
</pre> |
321 |
|
328 |
|
322 |
<p> |
329 |
<p> |
323 |
Again, the name in brackets <path>"[]"</path> are the IDs that you have to pass |
330 |
Again, the names in brackets (<e>[]</e>) are the IDs that you have to pass to |
324 |
to <c>java-config --set-system-classpath</c>.<br/> |
331 |
<c>java-config --set-system-classpath</c>. Here is an example: |
325 |
Here is an example: |
|
|
326 |
</p> |
332 |
</p> |
327 |
|
333 |
|
328 |
<pre caption="Setting classpaths"> |
334 |
<pre caption="Setting classpaths"> |
Lines 330-337
Link Here
|
330 |
</pre> |
336 |
</pre> |
331 |
|
337 |
|
332 |
<note> |
338 |
<note> |
333 |
The current directory (.) will not be part of the system classpath, as that |
339 |
The current directory (<path>.</path>) will not be part of the system |
334 |
should be added in your system's login profile. |
340 |
classpath, as that should be added in your system's login profile. |
335 |
</note> |
341 |
</note> |
336 |
|
342 |
|
337 |
<p> |
343 |
<p> |
Lines 386-397
Link Here
|
386 |
<ul> |
392 |
<ul> |
387 |
<li>The <b>java</b> flag adds support for Java in a variety of programs</li> |
393 |
<li>The <b>java</b> flag adds support for Java in a variety of programs</li> |
388 |
<li> |
394 |
<li> |
389 |
The <b>nsplugin</b> flag adds support for Mozilla-like browsers |
395 |
The <b>nsplugin</b> flag adds support for Mozilla-like browsers (including |
390 |
(including Firefox).You will need this for viewing Java applets in your |
396 |
Firefox).You will need this for viewing Java applets in your Mozilla-like |
391 |
Mozilla-like browser. |
397 |
browser. |
|
|
398 |
</li> |
399 |
<li> |
400 |
The <b>doc</b> flag will typically install API documentation, as generated |
401 |
by javadoc. |
402 |
</li> |
403 |
<li> |
404 |
The <b>source</b> flag will install a zip of the package's source code. |
405 |
This is typicall used to provide your IDE with the source code for the |
406 |
package. |
392 |
</li> |
407 |
</li> |
393 |
<li>The <b>doc</b> flag will typically install API documentation, as generated by javadoc.</li> |
|
|
394 |
<li>The <b>source</b> flag will install a zip of the package's source code. This is typicall used to provide your IDE with the source code for the package.</li> |
395 |
</ul> |
408 |
</ul> |
396 |
|
409 |
|
397 |
</body> |
410 |
</body> |
Lines 416-432
Link Here
|
416 |
<body> |
429 |
<body> |
417 |
|
430 |
|
418 |
<ul> |
431 |
<ul> |
419 |
<li>The <uri link="http://www.gentoo.org/proj/en/java/">Java Project Page</uri></li> |
|
|
420 |
<li> |
432 |
<li> |
421 |
The |
433 |
The <uri link="http://www.gentoo.org/proj/en/java/">Java Project |
422 |
<uri link="http://news.gmane.org/gmane.linux.gentoo.java">gentoo-java</uri>, |
434 |
Page</uri> |
423 |
<uri link="http://news.gmane.org/gmane.linux.gentoo.user">gentoo-user</uri>, |
435 |
</li> |
|
|
436 |
<li> |
437 |
The <uri |
438 |
link="http://news.gmane.org/gmane.linux.gentoo.java">gentoo-java</uri>, |
439 |
<uri |
440 |
link="http://news.gmane.org/gmane.linux.gentoo.user">gentoo-user</uri>, |
424 |
<uri link="http://news.gmane.org/gmane.linux.gentoo.devel">gentoo-dev</uri> |
441 |
<uri link="http://news.gmane.org/gmane.linux.gentoo.devel">gentoo-dev</uri> |
425 |
mailing list archives |
442 |
mailing list archives |
426 |
</li> |
443 |
</li> |
427 |
<li>#gentoo and #gentoo-java on irc.freenode.net</li> |
444 |
<li>#gentoo and #gentoo-java on irc.freenode.net</li> |
428 |
<li> |
445 |
<li> |
429 |
<uri link="http://en.wikipedia.org/wiki/Java_programming_language">Wikipedia's entry for Java</uri> |
446 |
<uri |
|
|
447 |
link="http://en.wikipedia.org/wiki/Java_programming_language">Wikipedia's |
448 |
entry for Java</uri> |
430 |
</li> |
449 |
</li> |
431 |
</ul> |
450 |
</ul> |
432 |
|
451 |
|
Lines 434-436
Link Here
|
434 |
</section> |
453 |
</section> |
435 |
</chapter> |
454 |
</chapter> |
436 |
</guide> |
455 |
</guide> |
|
|
456 |
|