1 |
nightmorph 06/06/24 18:28:06 |
2 |
|
3 |
Modified: java.xml |
4 |
Log: |
5 |
Overhauled, updated java guide for bug 137760. thanks to nichoj for putting in all the time and energy on the update. |
6 |
|
7 |
Revision Changes Path |
8 |
1.23 xml/htdocs/doc/en/java.xml |
9 |
|
10 |
file : http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/java.xml?rev=1.23&content-type=text/x-cvsweb-markup&cvsroot=gentoo |
11 |
plain: http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/java.xml?rev=1.23&content-type=text/plain&cvsroot=gentoo |
12 |
diff : http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/java.xml.diff?r1=1.22&r2=1.23&cvsroot=gentoo |
13 |
|
14 |
Index: java.xml |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/java.xml,v |
17 |
retrieving revision 1.22 |
18 |
retrieving revision 1.23 |
19 |
diff -u -r1.22 -r1.23 |
20 |
--- java.xml 6 Mar 2006 17:46:45 -0000 1.22 |
21 |
+++ java.xml 24 Jun 2006 18:28:06 -0000 1.23 |
22 |
@@ -1,29 +1,31 @@ |
23 |
<?xml version="1.0" encoding="UTF-8"?> |
24 |
-<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/java.xml,v 1.22 2006/03/06 17:46:45 neysx Exp $ --> |
25 |
+<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/java.xml,v 1.23 2006/06/24 18:28:06 nightmorph Exp $ --> |
26 |
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
27 |
|
28 |
<guide link="/doc/en/java.xml"> |
29 |
<title>Gentoo Java Guide</title> |
30 |
|
31 |
-<author title="Author and Editor"> |
32 |
+<author title="Author"> |
33 |
<mail link="karltk@g.o">Karl Trygve Kalleberg</mail> |
34 |
</author> |
35 |
-<author title="Editor"> |
36 |
- <mail link="swift@g.o">Sven Vermeulen</mail> |
37 |
+<author title="Author"> |
38 |
+ <mail link="nichoj@g.o">Joshua Nichols</mail> |
39 |
</author> |
40 |
<author title="Editor"> |
41 |
- <mail link="vanquirius@g.o">Marcelo Góes</mail> |
42 |
+ <mail link="nightmorph@g.o">Joshua Saddler</mail> |
43 |
</author> |
44 |
|
45 |
<abstract> |
46 |
-This guide will introduce users and developers to Java and explain how to use |
47 |
-Java with Gentoo Linux. |
48 |
+This guide will introduce you to Java and explain how to use Java with Gentoo |
49 |
+Linux. |
50 |
</abstract> |
51 |
|
52 |
+<!-- The content of this document is licensed under the CC-BY-SA license --> |
53 |
+<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
54 |
<license/> |
55 |
|
56 |
-<version>0.3</version> |
57 |
-<date>2005-12-12</date> |
58 |
+<version>0.4</version> |
59 |
+<date>2006-06-24</date> |
60 |
|
61 |
<chapter> |
62 |
<title>What is Java?</title> |
63 |
@@ -32,21 +34,22 @@ |
64 |
<body> |
65 |
|
66 |
<p> |
67 |
-Java is a programming language developed by engineers of Sun Microsystems. |
68 |
-The language is object-oriented and designed to run on multiple platforms |
69 |
-without the need of recompiling code for each platform. Although Java can |
70 |
-be compiled as a native program, much of Java's popularity can be attributed |
71 |
-to its portability, along with other features such as garbage collection. |
72 |
-The ability to compile once and run in various platforms is achieved through |
73 |
-the use of just-in-time compilers (JIT), which compile Java bytecodes into |
74 |
-native code when a given program is run. |
75 |
+Java is a programming language developed by engineers of Sun Microsystems. The |
76 |
+language is object-oriented and designed to run on multiple platforms without |
77 |
+the need of recompiling code for each platform. Although Java can be compiled |
78 |
+as a native program, much of Java's popularity can be attributed to its |
79 |
+portability, along with other features such as garbage collection. To make |
80 |
+platform independence possible the Java compiler compiles the Java code to an |
81 |
+intermediate representation called "Java bytecode" that runs on a JRE (Java |
82 |
+Runtime Environment) and not directly on the operating system. |
83 |
</p> |
84 |
|
85 |
<p> |
86 |
-In order to run Java bytecodes, one needs to have a JRE (Java Runtime Environment) |
87 |
-installed. A JRE provides core libraries, a platform dependent Java Virtual Machine, |
88 |
-plug-ins for browsers, among other things. A JDK (Java Development Kit) adds |
89 |
-programming tools, such as a bytecode compiler and a debugger. |
90 |
+In order to run Java bytecode, one needs to have a JRE (Java Runtime |
91 |
+Environment) installed. A JRE provides core libraries, a platform dependent |
92 |
+Java Virtual Machine, plug-ins for browsers, among other things. A JDK (Java |
93 |
+Development Kit) adds programming tools, such as a bytecode compiler and a |
94 |
+debugger. |
95 |
</p> |
96 |
|
97 |
</body> |
98 |
@@ -60,55 +63,98 @@ |
99 |
<body> |
100 |
|
101 |
<p> |
102 |
-Gentoo provides numerous JREs and JDKs. Among the current alternatives, we have: |
103 |
+Gentoo provides numerous JREs and JDKs. Among the current alternatives, we |
104 |
+have: |
105 |
</p> |
106 |
|
107 |
-<ul> |
108 |
- <li>blackdown-jre and blackdown-jdk, the Blackdown Java Kit</li> |
109 |
- <li>sun-jre-bin and sun-jdk, Sun's Java Kit </li> |
110 |
- <li>ibm-jre-bin and ibm-jdk-bin, the IBM Java Kit</li> |
111 |
- <li>compaq-jre and compaq-jdk, the Compaq Java Kit for Alpha/Linux/GNU</li> |
112 |
- <li>jrockit-jdk-bin, BEA WebLogic's J2SE Development Kit</li> |
113 |
-</ul> |
114 |
- |
115 |
-<p> |
116 |
-The default is the Blackdown JRE/JDK |
117 |
-pair, as it is freely ("free as in beer") available without any registration |
118 |
-fuss. |
119 |
+<table> |
120 |
+<tr> |
121 |
+ <th>Vendor</th> |
122 |
+ <th>JDK</th> |
123 |
+ <th>JRE</th> |
124 |
+</tr> |
125 |
+<tr> |
126 |
+ <ti>The Blackdown Java Kit</ti> |
127 |
+ <ti>dev-java/backdown-jdk</ti> |
128 |
+ <ti>dev-java/blackdown-jre</ti> |
129 |
+</tr> |
130 |
+<tr> |
131 |
+ <ti>Sun's Java Kit</ti> |
132 |
+ <ti>dev-java/sun-jdk</ti> |
133 |
+ <ti>dev-java/sun-jre-bin</ti> |
134 |
+</tr> |
135 |
+<tr> |
136 |
+ <ti>The IBM Java Kit</ti> |
137 |
+ <ti>dev-java/ibm-jdk-bin</ti> |
138 |
+ <ti>dev-java/ibm-jre-bin</ti> |
139 |
+</tr> |
140 |
+<tr> |
141 |
+ <ti>The Compaq Java Kit for Alpha/Linux/GNU</ti> |
142 |
+ <ti>dev-java/compaq-jdk</ti> |
143 |
+ <ti>dev-java/compaq-jre</ti> |
144 |
+</tr> |
145 |
+<tr> |
146 |
+ <ti>BEA WebLogic's J2SE Development Kit</ti> |
147 |
+ <ti>dev-java/jrockit-jdk-bin</ti> |
148 |
+</tr> |
149 |
+</table> |
150 |
+ |
151 |
+<!-- |
152 |
+TODO: list free implmentations? |
153 |
+note about not drop-in replacemenets |
154 |
+kaffe/sablevm/gcj/jamvm |
155 |
+--> |
156 |
+ |
157 |
+<p> |
158 |
+The default is Blackdown for both the JRE and the JDK, as it is freely ("free |
159 |
+as in beer") available without any registration fuss. |
160 |
</p> |
161 |
|
162 |
<p> |
163 |
-Both the Sun JRE/JDK and the IBM JRE/JDK are generally faster, but getting them |
164 |
-is a bit more work, as you are required to read and accept their license before |
165 |
-downloading (IBM additionally requires you to register). |
166 |
+Both the Sun and the IBM are generally faster, but getting them is a bit more |
167 |
+hassle, as you are required to read and accept their license before downloading |
168 |
+(IBM additionally requires you to register). |
169 |
</p> |
170 |
|
171 |
<p> |
172 |
-Our ebuilds for the Sun and IBM JRE/JDKs will notify you of where to go to |
173 |
-download them. |
174 |
+Our ebuilds for the Sun and IBM JRE/JDKs will inform you how to download the |
175 |
+appropriate files. |
176 |
</p> |
177 |
|
178 |
</body> |
179 |
</section> |
180 |
<section> |
181 |
-<title>Installing the Sun/IBM JRE/JDKs</title> |
182 |
+<title>Installing a JRE/JDKs</title> |
183 |
<body> |
184 |
|
185 |
<p> |
186 |
-If you run <c>emerge =sun-jdk-1.4.2.06</c> or <c>=ibm-jdk-bin-1.4.2</c>, you will |
187 |
-be notified that you are required to download the actual tarballs yourself. This |
188 |
-has to do with license restrictions for the Sun JRE/JDK (online click-wrap |
189 |
-license) and registration issues with the IBM JRE/JDK. |
190 |
+To install your profile's default JDK, you can run <c>emerge virtual/jdk</c>. |
191 |
+Or to install your profile's default JRE, you can <c>emerge virtual/jre</c>. |
192 |
</p> |
193 |
|
194 |
<note> |
195 |
-ibm-jdk-bin is currently masked, you may have to unmask it to use it. |
196 |
+A JDK also includes a JRE, so if you install a JDK you shouldn't have to also |
197 |
+have to install a JRE. |
198 |
</note> |
199 |
|
200 |
+</body> |
201 |
+</section> |
202 |
+<section> |
203 |
+<title>Installing the Sun/IBM JRE/JDKs</title> |
204 |
+<body> |
205 |
+ |
206 |
+<p> |
207 |
+If you run <c>emerge dev-java/sun-jdk</c> or <c>emerge |
208 |
+dev-java/ibm-jdk-bin</c>, you will be notified that you are required to |
209 |
+download the actual files yourself. This has to do with license restrictions |
210 |
+for the Sun JRE/JDK (online click-wrap license) and registration issues with |
211 |
+the IBM JRE/JDK. |
212 |
+</p> |
213 |
+ |
214 |
<p> |
215 |
You should download the indicated file(s) into |
216 |
-<path>/usr/portage/distfiles</path>. Once that is done, you can rerun the emerge |
217 |
-command, then the JRE/JDK will be installed properly into <path>/opt</path>. |
218 |
+<path>/usr/portage/distfiles</path>. Once there, you can rerun the emerge |
219 |
+command, at which point the JRE/JDK will be begin to install. |
220 |
</p> |
221 |
|
222 |
</body> |
223 |
@@ -122,75 +168,280 @@ |
224 |
<body> |
225 |
|
226 |
<p> |
227 |
-Gentoo has the ability to have multiple JDKs and JREs installed without them |
228 |
-conflicting. |
229 |
+Gentoo has the ability to have multiple JDKs and JREs installed without causing |
230 |
+conflicts. |
231 |
</p> |
232 |
|
233 |
<p> |
234 |
-Using the <c>java-config</c> tool, you can set the system-wide default if you |
235 |
-have root access. Users can also use <c>java-config</c> to set up their own |
236 |
-personal default, that is different from the system-wide default. |
237 |
+Using the <c>java-config</c> tool, you can set the system-wide default |
238 |
+(provided you have root access). Users can also use <c>java-config</c> to set |
239 |
+up their own personal default. |
240 |
</p> |
241 |
|
242 |
+<note> |
243 |
+You can also use <e>eselect</e> to change the system and user vm. See |
244 |
+<c>eselect java help</c>. |
245 |
+</note> |
246 |
+ |
247 |
</body> |
248 |
</section> |
249 |
- |
250 |
<section> |
251 |
<title>Setting a default JRE/JDK</title> |
252 |
<body> |
253 |
|
254 |
<p> |
255 |
-Running the command <c>java-config --list-available-vms</c> will give you a list |
256 |
-of all available JREs and JDKs on your system. Here is an example of output: |
257 |
+Running the command <c>java-config --list-available-vms</c> will give you a |
258 |
+list of all JREs and JDKs installed on your system. Here is an example of |
259 |
+output: |
260 |
</p> |
261 |
|
262 |
<pre caption="Listing available VMs"> |
263 |
# <i>java-config --list-available-vms</i> |
264 |
-[blackdown-jdk-1.3.1] Blackdown JDK 1.3.1 (/etc/env.d/java/20blackdown-jdk-1.3.1) |
265 |
-[blackdown-jre-1.3.1] Blackdown JRE 1.3.1 (/etc/env.d/java/20blackdown-jre-1.3.1) |
266 |
-[ibm-jdk-1.3.0] IBM JDK 1.3.0 (/etc/env.d/java/20ibm-jdk-1.3.0) |
267 |
-[ibm-jdk-1.3.1] IBM JDK 1.3.1 (/etc/env.d/java/20ibm-jdk-1.3.1) |
268 |
-[ibm-jre-1.3.1] IBM JRE 1.3.1 (/etc/env.d/java/20ibm-jre-1.3.1) |
269 |
-[sun-jdk-1.4.0] Sun JDK 1.4.0 (/etc/env.d/java/20sun-jdk-1.4.0) |
270 |
+1) Blackdown JDK 1.3.1 [blackdown-jdk-1.3] (/etc/env.d/java/20blackdown-jdk-1.3) |
271 |
+2) Blackdown JDK 1.4.2.02 [blackdown-jdk-1.4] (/etc/env.d/java/20blackdown-jdk-1.4) |
272 |
+3) Blackdown JRE 1.4.2.02 [blackdown-jre-1.4] (/etc/env.d/java/20blackdown-jre-1.4) |
273 |
+4) IBM JDK 1.4.2 [ibm-jdk-bin-1.4] (/etc/env.d/java/20ibm-jdk-bin-1.4) |
274 |
+5) IBM JRE 1.4.2 [ibm-jre-bin-1.4] (/etc/env.d/java/20ibm-jre-bin-1.4) |
275 |
+6) WebLogic JRockit 1.4.2.05 [jrockit-jdk-bin-1.4] (/etc/env.d/java/20jrockit-jdk-bin-1.4) |
276 |
+7) WebLogic JRockit 1.5.0.03 [jrockit-jdk-bin-1.5] (/etc/env.d/java/20jrockit-jdk-bin-1.5) |
277 |
+8) Sun JDK 1.3.1.13 [sun-jdk-1.3] (/etc/env.d/java/20sun-jdk-1.3) |
278 |
+9) Sun JDK 1.4.2.09 [sun-jdk-1.4] (/etc/env.d/java/20sun-jdk-1.4) |
279 |
+*) Sun JDK 1.5.0.04 [sun-jdk-1.5] (/etc/env.d/java/20sun-jdk-1.5) |
280 |
+11) Sun JRE 1.4.2.09 [sun-jre-bin-1.4] (/etc/env.d/java/20sun-jre-bin-1.4) |
281 |
+12) Sun JRE 1.5.0.04 [sun-jre-bin-1.5] (/etc/env.d/java/20sun-jre-bin-1.5) |
282 |
</pre> |
283 |
|
284 |
<p> |
285 |
-The name in the brackets <path>"[]"</path> is the handle or ID for that |
286 |
-particular VM. You use pass that ID to <c>java-config --set-system-vm</c>. Here is |
287 |
-an example of how to set the system VM. |
288 |
+The <e>*</e> indicates this is the current active vm (system-vm or user-vm when |
289 |
+set). The name in the brackets (<e>[]</e>) is the handle or ID for that |
290 |
+particular VM. You use the handle or the number to <c>java-config |
291 |
+--set-system-vm</c>. Here is an example of how to set the system VM. |
292 |
</p> |
293 |
|
294 |
<pre caption="Setting the System VM"> |
295 |
-# <i>java-config --set-system-vm ibm-jdk-1.3.1</i> |
296 |
-Now using IBM JDK 1.3.1 (/etc/env.d/java/20ibm-jdk-1.3.1) |
297 |
+<comment>(By handle (preferred))</comment> |
298 |
+# <i>java-config --set-system-vm blackdown-jdk-1.4</i> |
299 |
+<comment>(By number)</comment> |
300 |
+# <i>java-config --set-system-vm 2</i> |
301 |
</pre> |
302 |
|
303 |
+<p> |
304 |
+As a regular user, you can use <c>java-config --set-user-vm</c>. |
305 |
+</p> |
306 |
+ |
307 |
<note> |
308 |
-You will have to be root to run --set-system-vm. |
309 |
+You no longer have to <c>source</c> the profile for updates to the user/system |
310 |
+VM take place. |
311 |
</note> |
312 |
|
313 |
+</body> |
314 |
+</section> |
315 |
+<section id="preferred-vm"> |
316 |
+<title>Preferred VM</title> |
317 |
+<body> |
318 |
+ |
319 |
+<p> |
320 |
+While merging Java packages, the VM can and will be switched as necessary. |
321 |
+</p> |
322 |
+ |
323 |
+<p> |
324 |
+Because of the wide variety of available VMs, we do not have the resources to |
325 |
+test and verify every package works on all of them. So to ensure that every |
326 |
+packages merges smoothly, we have defined a list of <e>default/supported |
327 |
+VMs</e> per arch. You can find them in |
328 |
+<path>/usr/share/java-config/config/jdk-defaults.conf</path>. When you are |
329 |
+merging a Java package, and it detects one of the VM in that file is installed, |
330 |
+it will automatically use that VM, instead of the system-vm. |
331 |
+</p> |
332 |
+ |
333 |
<p> |
334 |
-Once you have issued <c>java-config --set-system-vm</c> with a particular VM |
335 |
-ID, you will need to regenerate your <path>/etc/profile.env</path>. You can do |
336 |
-it like this: |
337 |
+The merge time VM switching is also needed when, for example, your system-vm is |
338 |
+set a 1.4 VM and the package you are merging requires a 1.5 VM. While merging |
339 |
+it will use the preferred 1.5 VM, leaving your system-vm choice intact. |
340 |
</p> |
341 |
|
342 |
-<pre caption="Regenerating /etc/profile.env" > |
343 |
-# <i>env-update</i> |
344 |
+<p> |
345 |
+Of course, Gentoo is all about choice, so you can override these defaults in |
346 |
+<path>/etc/java-config-2/build/jdk.conf</path> and have complete control over |
347 |
+which VM will get used. Some examples: |
348 |
+</p> |
349 |
+ |
350 |
+<pre caption="Example /etc/java-config-2/build/jdk.conf"> |
351 |
+<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> |
352 |
+*=sun-jdk |
353 |
</pre> |
354 |
|
355 |
+<pre caption="Example /etc/java-config-2/build/jdk.conf"> |
356 |
+<comment>(Always use sun-jdk-1.5 wherever possible, except for when a 1.4 or 1.3 VM is explicitly required)</comment> |
357 |
+*=sun-jdk-1.5 |
358 |
+</pre> |
359 |
+ |
360 |
+<pre caption="Example /etc/java-config-2/build/jdk.conf"> |
361 |
+<comment># For 1.3 I prefer sun-jdk 1.4 but when it is not available, use ibm-jdk-bin, |
362 |
+# For 1.4, use blackdown-jdk, and for 1.5, use sun-jdk </comment> |
363 |
+1.3=sun-jdk-1.4 ibm-jdk-bin |
364 |
+1.4=blackdown-jdk |
365 |
+1.5=sun-jdk |
366 |
+</pre> |
367 |
+ |
368 |
+<warn> |
369 |
+You do not have to edit this file. If you change these options to use a |
370 |
+unsupported VM, things could possibly break. Bugs reported with a unsupported |
371 |
+VM will a lower priority if they aren't present with supported VMs. |
372 |
+</warn> |
373 |
+ |
374 |
+</body> |
375 |
+</section> |
376 |
+</chapter> |
377 |
+ |
378 |
+<chapter> |
379 |
+<title>Compilers</title> |
380 |
+<section> |
381 |
+<body> |
382 |
+ |
383 |
<p> |
384 |
-After this, you will either want to relogin, or resource |
385 |
-<path>/etc/profile</path> into your environment. |
386 |
+The standard Java compiler used for building is javac, which comes with each |
387 |
+JDK. In addition to configuring the VM used at build time, it is also possible |
388 |
+configure which compiler is used. Essentially, you define a list your |
389 |
+preference for which compiler to use in |
390 |
+<path>/etc/java-config-2/build/compilers.conf</path>. |
391 |
</p> |
392 |
|
393 |
+<pre caption="/etc/java-config-2/build/compilers.conf"> |
394 |
+# If the ebuild supports it |
395 |
+# it will check the COMPILERS var front to back and |
396 |
+# use the first compiler that is installed |
397 |
+ |
398 |
+COMPILERS="ecj-3.1 jikes javac" |
399 |
+</pre> |
400 |
+ |
401 |
<p> |
402 |
-As a regular user, you can use <c>java-config --set-user-vm</c>, which will |
403 |
-create <path>~/.gentoo/java-env</path> with all required env vars. You would |
404 |
-normally source this from your shell's startup script (generally |
405 |
-<path>~/.bashrc</path>). |
406 |
+Some compilers don't support all possible -target and -source arguments. |
407 |
+Therefore, each compiler in the list is checked to see if it can support the |
408 |
+desired -source/-target. javac will work in all cases, so if no other suitable |
409 |
+compiler is found, it will be used instead. |
410 |
</p> |
411 |
|
412 |
+<p> |
413 |
+More details about each compiler are provided below: |
414 |
+</p> |
415 |
+ |
416 |
+<table> |
417 |
+<tr> |
418 |
+ <th>Name</th> |
419 |
+ <th>Handle</th> |
420 |
+ <th>Package</th> |
421 |
+ <th>Description</th> |
422 |
+</tr> |
423 |
+<tr> |
424 |
+ <ti>javac</ti> |
425 |
+ <ti>javac</ti> |
426 |
+ <ti>N/A</ti> |
427 |
+ <ti> |
428 |
+ This is the default compiler that will be used, and comes with each JDK. |
429 |
+ </ti> |
430 |
+</tr> |
431 |
+<tr> |
432 |
+ <ti>jikes</ti> |
433 |
+ <ti>jikes</ti> |
434 |
+ <ti>dev-java/jikes</ti> |
435 |
+ <ti> |
436 |
+ Jikes was originally developed by IBM. Anecdotally, it is generally quicker |
437 |
+ than javac. Note however, that it is more pedantic, and will fail under a |
438 |
+ few circumstances where javac has no issue. It also does not support Java |
439 |
+ 1.5 syntax yet. |
440 |
+ </ti> |
441 |
+</tr> |
442 |
+<tr> |
443 |
+ <ti>Eclipse Compiler for Java</ti> |
444 |
+ <ti>ecj-3.1</ti> |
445 |
+ <ti>=dev-java/eclipse-ecj-3.1*</ti> |
446 |
+ <ti> |
447 |
+ ECJ is the compiler used by the Eclipse software development kit. It is |
448 |
+ very full featured, and is pretty fast. It does support Java 1.5 syntax. |
449 |
+ </ti> |
450 |
+</tr> |
451 |
+</table> |
452 |
+ |
453 |
+</body> |
454 |
+</section> |
455 |
+</chapter> |
456 |
+ |
457 |
+<chapter> |
458 |
+<title>Setting a default CLASSPATH</title> |
459 |
+<section> |
460 |
+<body> |
461 |
+ |
462 |
+<warn> |
463 |
+The options explained in this section should be considered deprecated and will |
464 |
+be most likely be removed in the future. We strongly recommend against using |
465 |
+these, because your Java projects or application should ideally manage their |
466 |
+own classpaths. If you choose to specify a default CLASSPATH, some applications |
467 |
+may behave unexpectedly, because classes they weren't expecting would be on the |
468 |
+classpath. |
469 |
+</warn> |
470 |
+ |
471 |
+<p> |
472 |
+<c>java-config</c> can also be used to set a system-wide default CLASSPATH, as |
473 |
+well a user-specific default CLASSPATH. |
474 |
+</p> |
475 |
+ |
476 |
+<p> |
477 |
+First, you will want to list available Java libraries installed on your system |
478 |
+that might want to be put in your CLASSPATH. Here is an example of output: |
479 |
+</p> |
480 |
+ |
481 |
+<pre caption="Listing classes"> |
482 |
+# <i>java-config --list-available-packages</i> |
483 |
+[xerces-2] The next generation of high performance, fully compliant XML parsers in the Apache Xerces family (/usr/share/xerces-2/package.env) |
484 |
+[junit] Simple framework to write repeatable tests (/usr/share/junit/package.env) |
485 |
+[bsh] BeanShell: A small embeddable Java source interpreter (/usr/share/bsh/package.env) |
486 |
+[bcel] The Byte Code Engineering Library: analyze, create, manipulate Java class files (/usr/share/bcel/package.env) |
487 |
+[log4j] A low-overhead robust logging package for Java (/usr/share/log4j/package.env) |
488 |
+... |
489 |
+</pre> |
490 |
+ |
491 |
+<p> |
492 |
+Again, the names in brackets (<e>[]</e>) are the IDs that you have to pass to |
493 |
+<c>java-config --set-system-classpath</c>. Here is an example: |
494 |
+</p> |
495 |
+ |
496 |
+<pre caption="Setting classpaths"> |
497 |
+# <i>java-config --set-system-classpath log4j,xerces-2</i> |
498 |
+</pre> |
499 |
+ |
500 |
+<note> |
501 |
+The current directory (<path>.</path>) will not be part of the system |
502 |
+classpath, as that should be added in your system's login profile. |
503 |
+</note> |
504 |
+ |
505 |
+<p> |
506 |
+You will have to update your environment by relogging in or sourcing |
507 |
+<path>/etc/profile</path>. |
508 |
+</p> |
509 |
+ |
510 |
+<p> |
511 |
+For users, <c>java-config --set-user-classpath</c> will create |
512 |
+<path>~/.gentoo/java-env-classpath</path>, which you should then source from |
513 |
+your shell's profile. |
514 |
+</p> |
515 |
+ |
516 |
+<pre caption="Sourcing user specific classpath"> |
517 |
+<i>if [[ -f "${HOME}/.gentoo/java-env-classpath" ]]; then |
518 |
+ source ${HOME}/.gentoo/java-env-classpath |
519 |
+fi</i> |
520 |
+</pre> |
521 |
+ |
522 |
+<p> |
523 |
+If you really want a system wide or user default classpath you can add |
524 |
+something like like the following to your shell's profile. But we would advise |
525 |
+against it. |
526 |
+</p> |
527 |
+ |
528 |
+<pre caption="Setting classpath"> |
529 |
+# <i>export CLASSPATH="${CLASSPATH}:$(java-config --classpath log4j,xerces-2)"</i> |
530 |
+</pre> |
531 |
+ |
532 |
</body> |
533 |
</section> |
534 |
</chapter> |
535 |
@@ -214,12 +465,20 @@ |
536 |
<body> |
537 |
|
538 |
<ul> |
539 |
- <li>The <b>java</b> flag adds support for Java in a variety of programs.</li> |
540 |
+ <li>The <b>java</b> flag adds support for Java in a variety of programs</li> |
541 |
+ <li> |
542 |
+ The <b>nsplugin</b> flag adds support for Mozilla-like browsers (including |
543 |
+ Firefox).You will need this for viewing Java applets in your Mozilla-like |
544 |
+ browser. |
545 |
+ </li> |
546 |
<li> |
547 |
- The <b>nsplugin</b> flag adds a symlink to the javaplugin for |
548 |
- Mozilla-like browsers (including Firefox) if you are using, for example, |
549 |
- Blackdown's Java kit, IBM Java Kit or Sun's Java Kit. You will need this |
550 |
- for viewing Java applets in your Mozilla-like browser. |
551 |
+ The <b>doc</b> flag will typically install API documentation, as generated |
552 |
+ by javadoc. |
553 |
+ </li> |
554 |
+ <li> |
555 |
+ The <b>source</b> flag will install a zip of the package's source code. |
556 |
+ This is typically used to provide your IDE with the source code for the |
557 |
+ package. |
558 |
</li> |
559 |
</ul> |
560 |
|
561 |
@@ -236,7 +495,6 @@ |
562 |
<ul> |
563 |
<li>java-config man page</li> |
564 |
<li><c>java-config --help</c></li> |
565 |
- <li>The <path>/usr/bin/java-config</path> script itself</li> |
566 |
</ul> |
567 |
|
568 |
</body> |
569 |
@@ -246,13 +504,17 @@ |
570 |
<body> |
571 |
|
572 |
<ul> |
573 |
- <li>The <uri link="/proj/en/java/">Gentoo Java Project Page</uri></li> |
574 |
+ <li> |
575 |
+ The <uri link="http://www.gentoo.org/proj/en/java/">Java Project |
576 |
+ Page</uri> |
577 |
+ </li> |
578 |
<li> |
579 |
The <uri |
580 |
- link="http://news.gmane.org/gmane.linux.gentoo.devel">gentoo-dev</uri>, |
581 |
- <uri link="http://news.gmane.org/gmane.linux.gentoo.user">gentoo-user |
582 |
- </uri> and <uri |
583 |
- link="http://news.gmane.org/gmane.linux.gentoo.java">gentoo-java</uri> |
584 |
+ link="http://news.gmane.org/gmane.linux.gentoo.java">gentoo-java</uri>, |
585 |
+ <uri |
586 |
+ link="http://news.gmane.org/gmane.linux.gentoo.user">gentoo-user</uri>, and |
587 |
+ <uri |
588 |
+ link="http://news.gmane.org/gmane.linux.gentoo.devel">gentoo-dev</uri> |
589 |
mailing list archives |
590 |
</li> |
591 |
<li>#gentoo and #gentoo-java on irc.freenode.net</li> |
592 |
|
593 |
|
594 |
|
595 |
-- |
596 |
gentoo-doc-cvs@g.o mailing list |