| 1 | <?xml version="1.0" encoding="UTF-8"?> |
1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/java.xml,v 1.48 2010/03/31 23:38:40 nightmorph Exp $ --> |
|
|
| 3 | <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
2 | <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
|
|
3 | <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/java.xml,v 1.52 2011/11/08 23:38:12 nightmorph Exp $ --> |
| 4 | |
4 | |
| 5 | <guide> |
5 | <guide> |
| 6 | <title>Gentoo Java Guide</title> |
6 | <title>Gentoo Java Guide</title> |
| 7 | |
7 | |
| 8 | <author title="Author"> |
8 | <author title="Author"> |
| … | |
… | |
| 22 | |
22 | |
| 23 | <!-- The content of this document is licensed under the CC-BY-SA license --> |
23 | <!-- The content of this document is licensed under the CC-BY-SA license --> |
| 24 | <!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
24 | <!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
| 25 | <license/> |
25 | <license/> |
| 26 | |
26 | |
| 27 | <version>0.22</version> |
27 | <version>3</version> |
| 28 | <date>2009-12-23</date> |
28 | <date>2011-11-08</date> |
| 29 | |
29 | |
| 30 | <chapter> |
30 | <chapter> |
| 31 | <title>What is Java?</title> |
31 | <title>What is Java?</title> |
| 32 | <section> |
32 | <section> |
| 33 | <title>Overview</title> |
33 | <title>Overview</title> |
| … | |
… | |
| 55 | </body> |
55 | </body> |
| 56 | </section> |
56 | </section> |
| 57 | </chapter> |
57 | </chapter> |
| 58 | |
58 | |
| 59 | <chapter> |
59 | <chapter> |
| 60 | <title>Before You Begin</title> |
|
|
| 61 | <section> |
|
|
| 62 | <title>Existing installs</title> |
|
|
| 63 | <body> |
|
|
| 64 | |
|
|
| 65 | <p> |
|
|
| 66 | For existing installs, regardless of if you have installed anything Java |
|
|
| 67 | before, make sure you have followed the <uri |
|
|
| 68 | link="/proj/en/java/java-upgrade.xml">Java Upgrade Guide</uri>. |
|
|
| 69 | </p> |
|
|
| 70 | |
|
|
| 71 | </body> |
|
|
| 72 | </section> |
|
|
| 73 | <section> |
|
|
| 74 | <title>New installs</title> |
|
|
| 75 | <body> |
|
|
| 76 | |
|
|
| 77 | <p> |
|
|
| 78 | New installs should require no further preparation. |
|
|
| 79 | </p> |
|
|
| 80 | |
|
|
| 81 | </body> |
|
|
| 82 | </section> |
|
|
| 83 | </chapter> |
|
|
| 84 | |
|
|
| 85 | <chapter> |
|
|
| 86 | <title>Installing a Virtual Machine</title> |
60 | <title>Installing a Virtual Machine</title> |
| 87 | <section> |
61 | <section> |
| 88 | <title>The choices</title> |
62 | <title>The choices</title> |
| 89 | <body> |
63 | <body> |
| 90 | |
64 | |
| … | |
… | |
| 110 | <ti>dev-java/ibm-jre-bin</ti> |
84 | <ti>dev-java/ibm-jre-bin</ti> |
| 111 | </tr> |
85 | </tr> |
| 112 | <tr> |
86 | <tr> |
| 113 | <ti>BEA WebLogic's J2SE Development Kit</ti> |
87 | <ti>BEA WebLogic's J2SE Development Kit</ti> |
| 114 | <ti>dev-java/jrockit-jdk-bin</ti> |
88 | <ti>dev-java/jrockit-jdk-bin</ti> |
|
|
89 | </tr> |
|
|
90 | <tr> |
|
|
91 | <ti>The IcedTea Open Java Kit</ti> |
|
|
92 | <ti>dev-java/icedtea-bin</ti> |
| 115 | </tr> |
93 | </tr> |
| 116 | </table> |
94 | </table> |
| 117 | |
95 | |
| 118 | <!-- |
96 | <!-- |
| 119 | TODO: list free implementations? |
97 | TODO: list free implementations? |
| … | |
… | |
| 130 | To install your profile's default JDK, you can run <c>emerge virtual/jdk</c>. |
108 | To install your profile's default JDK, you can run <c>emerge virtual/jdk</c>. |
| 131 | Or to install your profile's default JRE, you can <c>emerge virtual/jre</c>. |
109 | Or to install your profile's default JRE, you can <c>emerge virtual/jre</c>. |
| 132 | </p> |
110 | </p> |
| 133 | |
111 | |
| 134 | <p> |
112 | <p> |
| 135 | In recent events, Sun has relicensed their JDK and JRE under a more Linux |
113 | Some JDKs and JREs, including the Sun packages, require accepting an End User |
| 136 | distro friendly license. As a result, Sun Java 1.5 and onwards are |
114 | License Agreement, or EULA. If its license (such as dlj-1.1) is not listed in |
| 137 | freely downloadable, without any further hassle. |
115 | ACCEPT_LICENSE in <path>/etc/make.conf</path>, then you won't be able to install |
|
|
116 | the JDK/JRE. For more information on how to add acceptable licenses to |
|
|
117 | <path>make.conf</path>, please read the <uri |
|
|
118 | link="/doc/en/handbook/handbook-x86.xml?part=2&chap=1#doc_chap4">Portage |
|
|
119 | Handbook</uri>. |
|
|
120 | </p> |
|
|
121 | |
|
|
122 | <p> |
|
|
123 | To avoid any restrictive license hassle, consider installing |
|
|
124 | <c>icedtea-bin</c>, which is an open Java implementation from the OpenJDK |
|
|
125 | project. |
| 138 | </p> |
126 | </p> |
| 139 | |
127 | |
| 140 | <note> |
128 | <note> |
| 141 | A JDK also includes a JRE, so if you install a JDK you shouldn't have to also |
129 | A JDK also includes a JRE, so if you install a JDK you shouldn't have to also |
| 142 | have to install a JRE. |
130 | have to install a JRE. |
| … | |
… | |
| 199 | </p> |
187 | </p> |
| 200 | |
188 | |
| 201 | <pre caption="Listing available VMs"> |
189 | <pre caption="Listing available VMs"> |
| 202 | # <i>java-config --list-available-vms</i> |
190 | # <i>java-config --list-available-vms</i> |
| 203 | The following VMs are available for generation-2: |
191 | The following VMs are available for generation-2: |
| 204 | 1) IcedTea6-bin 1.4.1 [icedtea6-bin] |
192 | 1) IcedTea-bin 1.10.4 [icedtea-bin] |
| 205 | 2) Sun JDK 1.5.0.20 [sun-jdk-1.5] <comment>(Build Only)</comment> |
193 | 2) Sun JDK 1.5.0.20 [sun-jdk-1.5] <comment>(Build Only)</comment> |
| 206 | *) Sun JDK 1.6.0.16 [sun-jdk-1.6] |
194 | *) Sun JDK 1.6.0.16 [sun-jdk-1.6] |
| 207 | </pre> |
195 | </pre> |
| 208 | |
196 | |
| 209 | <note> |
197 | <note> |
| … | |
… | |
| 257 | </p> |
245 | </p> |
| 258 | |
246 | |
| 259 | </body> |
247 | </body> |
| 260 | </section> |
248 | </section> |
| 261 | <section id="preferred-vm"> |
249 | <section id="preferred-vm"> |
| 262 | <title>Preferred VM</title> |
250 | <title>Preferred Build VM</title> |
| 263 | <body> |
251 | <body> |
| 264 | |
252 | |
| 265 | <p> |
|
|
| 266 | While merging Java packages, the VM can and will be switched as necessary. |
|
|
| 267 | </p> |
253 | <p> |
| 268 | |
254 | While merging Java packages, the VM used for building can sometimes be different |
|
|
255 | from the one currently set as the system VM. |
| 269 | <p> |
256 | </p> |
| 270 | Because of the wide variety of available VMs, we do not have the resources to |
257 | |
| 271 | test and verify every package works on all of them. So to ensure that every |
258 | <p> |
| 272 | packages merges smoothly, we have defined a list of <e>default/supported |
259 | This merge time VM switching is needed when, for example, your system-vm is |
|
|
260 | set to a 1.6 VM and the package you are merging requires a 1.5 VM. While merging |
|
|
261 | it will select and use a 1.5 VM, leaving your system-vm choice intact. |
|
|
262 | </p> |
|
|
263 | |
|
|
264 | <p> |
|
|
265 | To define which VM is selected when a switch is needed, we have created a list of <e>default/supported |
| 273 | VMs</e> per arch. You can find them in |
266 | VMs</e> per arch. You can find them in |
| 274 | <path>/usr/share/java-config-2/config/jdk-defaults.conf</path>. When you are |
267 | <path>/usr/share/java-config-2/config/jdk-defaults.conf</path>. |
| 275 | merging a Java package, and it detects one of the VM in that file is installed, |
|
|
| 276 | it will automatically use that VM, instead of the system-vm. |
|
|
| 277 | </p> |
|
|
| 278 | |
|
|
| 279 | <p> |
268 | </p> |
| 280 | The merge time VM switching is also needed when, for example, your system-vm is |
269 | |
| 281 | set a 1.4 VM and the package you are merging requires a 1.5 VM. While merging |
|
|
| 282 | it will use the preferred 1.5 VM, leaving your system-vm choice intact. |
|
|
| 283 | </p> |
270 | <p> |
| 284 | |
271 | You can override these defaults (and even your selected system VM) in |
| 285 | <p> |
|
|
| 286 | Of course, Gentoo is all about choice, so you can override these defaults in |
|
|
| 287 | <path>/etc/java-config-2/build/jdk.conf</path> and have complete control over |
272 | <path>/etc/java-config-2/build/jdk.conf</path> and have complete control over |
| 288 | which VM will get used. Some examples: |
273 | which VM will get used for merging. Some examples: |
| 289 | </p> |
274 | </p> |
| 290 | |
275 | |
| 291 | <pre caption="Example /etc/java-config-2/build/jdk.conf"> |
276 | <pre caption="Example /etc/java-config-2/build/jdk.conf"> |
| 292 | <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> |
277 | <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> |
| 293 | *=sun-jdk |
278 | *=sun-jdk |
| … | |
… | |
| 305 | 1.5=sun-jdk |
290 | 1.5=sun-jdk |
| 306 | </pre> |
291 | </pre> |
| 307 | |
292 | |
| 308 | <warn> |
293 | <warn> |
| 309 | You do not <e>have</e> to edit this file. If you change these options to use a |
294 | You do not <e>have</e> to edit this file. If you change these options to use a |
| 310 | unsupported VM, things could possibly break. Bugs reported with a unsupported VM |
295 | unsupported VM, things could possibly break. Because of the wide variety of |
|
|
296 | available VMs, we do not have the resources to test and verify every package |
|
|
297 | works on all of them. Bugs reported with a unsupported VM won't be prioritized |
| 311 | won't be prioritized as much as bugs present within supported VMs. |
298 | as much as bugs present within supported VMs. |
| 312 | </warn> |
299 | </warn> |
| 313 | |
300 | |
| 314 | </body> |
301 | </body> |
| 315 | </section> |
302 | </section> |
| 316 | </chapter> |
303 | </chapter> |
| … | |
… | |
| 319 | <title>Compilers</title> |
306 | <title>Compilers</title> |
| 320 | <section> |
307 | <section> |
| 321 | <body> |
308 | <body> |
| 322 | |
309 | |
| 323 | <p> |
310 | <p> |
| 324 | The standard Java compiler used for building is javac, which comes with each |
311 | The standard Java compiler used for building is <c>javac</c>, which comes with |
| 325 | JDK. In addition to configuring the VM used at build time, it is also possible |
312 | each JDK. In addition to configuring the VM used at build time, it is also |
| 326 | configure which compiler is used. Essentially, you define a list your |
313 | possible configure which compiler is used. Essentially, you define a list your |
| 327 | preference for which compiler to use in |
314 | preference for which compiler to use in |
| 328 | <path>/etc/java-config-2/build/compilers.conf</path>. |
315 | <path>/etc/java-config-2/build/compilers.conf</path>. |
| 329 | </p> |
316 | </p> |
| 330 | |
317 | |
| 331 | <pre caption="/etc/java-config-2/build/compilers.conf"> |
318 | <pre caption="/etc/java-config-2/build/compilers.conf"> |
| … | |
… | |
| 491 | </p> |
478 | </p> |
| 492 | |
479 | |
| 493 | <pre caption="Viewing available plugins"> |
480 | <pre caption="Viewing available plugins"> |
| 494 | # <i>eselect java-nsplugin list</i> |
481 | # <i>eselect java-nsplugin list</i> |
| 495 | [1] sun-jre-bin-1.6 |
482 | [1] sun-jre-bin-1.6 |
| 496 | [2] icedtea6-bin |
483 | [2] icedtea-bin |
| 497 | </pre> |
484 | </pre> |
| 498 | |
485 | |
| 499 | <p> |
486 | <p> |
| 500 | In this example, <c>sun-jre-bin</c> is selected for the browser plugin. |
487 | In this example, <c>sun-jre-bin</c> is selected for the browser plugin. |
| 501 | </p> |
488 | </p> |
| … | |
… | |
| 509 | </p> |
496 | </p> |
| 510 | |
497 | |
| 511 | <pre caption="Verifying the correct plugin"> |
498 | <pre caption="Verifying the correct plugin"> |
| 512 | # <i>eselect java-nsplugin list</i> |
499 | # <i>eselect java-nsplugin list</i> |
| 513 | [1] sun-jre-bin-1.6 current |
500 | [1] sun-jre-bin-1.6 current |
| 514 | [2] icedtea6-bin |
501 | [2] icedtea-bin |
| 515 | </pre> |
502 | </pre> |
| 516 | |
503 | |
| 517 | <p> |
504 | <p> |
| 518 | Java.com also provides a link to <uri |
505 | Java.com also provides a link to <uri |
| 519 | link="http://java.com/en/download/installed.jsp">verify your installed |
506 | link="http://java.com/en/download/installed.jsp">verify your installed |
| … | |
… | |
| 563 | # <i>eselect java-nsplugin list</i> |
550 | # <i>eselect java-nsplugin list</i> |
| 564 | Available 32-bit Java browser plugins |
551 | Available 32-bit Java browser plugins |
| 565 | [1] emul-linux-x86-java-1.5 |
552 | [1] emul-linux-x86-java-1.5 |
| 566 | [2] emul-linux-x86-java-1.6 |
553 | [2] emul-linux-x86-java-1.6 |
| 567 | Available 64-bit Java browser plugins |
554 | Available 64-bit Java browser plugins |
| 568 | [1] icedtea6-bin |
555 | [1] icedtea-bin |
| 569 | [2] sun-jre-bin-1.6 |
556 | [2] sun-jre-bin-1.6 |
| 570 | </pre> |
557 | </pre> |
| 571 | |
558 | |
| 572 | <p> |
559 | <p> |
| 573 | Now select the right plugin for your browsers: |
560 | Now select the right plugin for your browsers: |
| … | |
… | |
| 587 | # <i>eselect java-nsplugin list</i> |
574 | # <i>eselect java-nsplugin list</i> |
| 588 | Available 32-bit Java browser plugins |
575 | Available 32-bit Java browser plugins |
| 589 | [1] emul-linux-x86-java-1.5 |
576 | [1] emul-linux-x86-java-1.5 |
| 590 | [2] emul-linux-x86-java-1.6 current |
577 | [2] emul-linux-x86-java-1.6 current |
| 591 | Available 64-bit Java browser plugins |
578 | Available 64-bit Java browser plugins |
| 592 | [1] icedtea6-bin |
579 | [1] icedtea-bin |
| 593 | [2] sun-jre-bin-1.6 current |
580 | [2] sun-jre-bin-1.6 current |
| 594 | </pre> |
581 | </pre> |
| 595 | |
582 | |
| 596 | </body> |
583 | </body> |
| 597 | </section> |
584 | </section> |