| 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.40 2008/01/02 01:41:02 nightmorph Exp $ --> |
2 | <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/java.xml,v 1.44 2009/10/07 18:14:31 nightmorph Exp $ --> |
| 3 | <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
3 | <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
| 4 | |
4 | |
| 5 | <guide link="/doc/en/java.xml"> |
5 | <guide link="/doc/en/java.xml"> |
| 6 | <title>Gentoo Java Guide</title> |
6 | <title>Gentoo Java Guide</title> |
| 7 | |
7 | |
| … | |
… | |
| 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.16</version> |
27 | <version>0.19</version> |
| 28 | <date>2008-01-01</date> |
28 | <date>2009-10-07</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> |
| … | |
… | |
| 119 | <ti>dev-java/jrockit-jdk-bin</ti> |
119 | <ti>dev-java/jrockit-jdk-bin</ti> |
| 120 | </tr> |
120 | </tr> |
| 121 | </table> |
121 | </table> |
| 122 | |
122 | |
| 123 | <!-- |
123 | <!-- |
| 124 | TODO: list free implementations? |
124 | TODO: list free implementations? |
| 125 | note about not drop-in replacements |
125 | note about not drop-in replacements |
| 126 | kaffe/sablevm/gcj/jamvm |
126 | kaffe/sablevm/gcj/jamvm |
| 127 | --> |
127 | --> |
| 128 | <p> |
128 | <p> |
| 129 | The default for Java 1.4 is the Blackdown JRE/JDK pair, as it is freely |
129 | The default for Java 1.6 is the Sun JRE/JDK pair. |
| 130 | ("free as in beer") available without any registration fuss. |
|
|
| 131 | </p> |
|
|
| 132 | |
|
|
| 133 | <p> |
|
|
| 134 | JREs and JDKs from Sun, IBM, and BEA are generally faster, but getting them |
|
|
| 135 | is a bit more work, as you are required to read and accept their license before |
|
|
| 136 | downloading (IBM additionally requires you to register). |
|
|
| 137 | </p> |
130 | </p> |
| 138 | |
131 | |
| 139 | </body> |
132 | </body> |
| 140 | </section> |
133 | </section> |
| 141 | <section> |
134 | <section> |
| … | |
… | |
| 163 | <section> |
156 | <section> |
| 164 | <title>Installing fetch-restricted virtual machines</title> |
157 | <title>Installing fetch-restricted virtual machines</title> |
| 165 | <body> |
158 | <body> |
| 166 | |
159 | |
| 167 | <p> |
160 | <p> |
| 168 | As already mentioned, some of the JDKs and JREs require you to jump through a |
161 | Some of the JDKs and JREs require you to jump through a few hoops before |
| 169 | few hoops before installing. Simply emerge the packages as you normally would. |
162 | installing. Simply emerge the packages as you normally would. The ebuilds will |
| 170 | The ebuilds will then instruct you where to go and what to download. |
163 | then instruct you where to go and what to download. |
| 171 | </p> |
164 | </p> |
| 172 | |
165 | |
| 173 | <p> |
166 | <p> |
| 174 | You should download the indicated file(s) into |
167 | You should download the indicated file(s) into |
| 175 | <path>/usr/portage/distfiles</path>. Once there, you can rerun the emerge |
168 | <path>/usr/portage/distfiles</path>. Once there, you can rerun the emerge |
| … | |
… | |
| 215 | </p> |
208 | </p> |
| 216 | |
209 | |
| 217 | <pre caption="Listing available VMs"> |
210 | <pre caption="Listing available VMs"> |
| 218 | # <i>java-config --list-available-vms</i> |
211 | # <i>java-config --list-available-vms</i> |
| 219 | The following VMs are available for generation-2: |
212 | The following VMs are available for generation-2: |
| 220 | 1) Blackdown JDK 1.4.2.03 [blackdown-jdk-1.4.2] |
213 | 1) Blackdown JDK 1.4.2.03 [blackdown-jdk-1.4.2] <comment>(Build Only)</comment> |
| 221 | 2) Blackdown JRE 1.4.2.03 [blackdown-jre-1.4.2] |
214 | 2) Blackdown JRE 1.4.2.03 [blackdown-jre-1.4.2] <comment>(Build Only)</comment> |
| 222 | 3) Blackdown 32bit JRE 1.4.2.03 [emul-linux-x86-java-1.4.2] |
215 | 3) IcedTea6-bin 1.4.1 [icedtea6-bin] |
| 223 | 4) Sun 32bit JRE 1.5.0.08 [emul-linux-x86-java-1.5] |
216 | 4) Sun JDK 1.5.0.20 [sun-jdk-1.5] <comment>(Build Only)</comment> |
| 224 | 5) Kaffe 1.1.7 [kaffe] |
|
|
| 225 | *) Sun JDK 1.5.0.08 [sun-jdk-1.5] |
217 | *) Sun JDK 1.6.0.16 [sun-jdk-1.6] |
| 226 | </pre> |
218 | </pre> |
|
|
219 | |
|
|
220 | <note> |
|
|
221 | VMs marked as Build Only may contain security vulnerabilities and/or be EOL. |
|
|
222 | Gentoo recommends not setting these VMs as either your system or user VM. |
|
|
223 | Please see <uri link="java.xml#build-only">Build Only VM</uri> for more |
|
|
224 | information. |
|
|
225 | </note> |
| 227 | |
226 | |
| 228 | <p> |
227 | <p> |
| 229 | The <e>*</e> indicates this is the current active vm (system-vm or user-vm when |
228 | The <e>*</e> indicates this is the current active vm (system-vm or user-vm when |
| 230 | set). The name in the brackets (<e>[]</e>) is the handle or ID for that |
229 | set). The name in the brackets (<e>[]</e>) is the handle or ID for that |
| 231 | particular VM. You use the handle or the number to <c>java-config |
230 | particular VM. You use the handle or the number to <c>java-config |
| … | |
… | |
| 234 | |
233 | |
| 235 | <pre caption="Setting the System VM"> |
234 | <pre caption="Setting the System VM"> |
| 236 | <comment>(By handle (preferred))</comment> |
235 | <comment>(By handle (preferred))</comment> |
| 237 | # <i>java-config --set-system-vm blackdown-jdk-1.4</i> |
236 | # <i>java-config --set-system-vm blackdown-jdk-1.4</i> |
| 238 | Now using blackdown-jdk-1.4 as your generation-2 system JVM |
237 | Now using blackdown-jdk-1.4 as your generation-2 system JVM |
|
|
238 | WARNING: blackdown-jdk-1.4 is marked as a build-only JVM. Using this vm is not recommended. |
| 239 | <comment>(By number)</comment> |
239 | <comment>(By number)</comment> |
| 240 | # <i>java-config --set-system-vm 6</i> |
240 | # <i>java-config --set-system-vm 5</i> |
| 241 | Now using sun-jdk-1.5 as your generation-2 system JVM |
241 | Now using sun-jdk-1.6 as your generation-2 system JVM |
| 242 | </pre> |
242 | </pre> |
| 243 | |
243 | |
| 244 | <p> |
244 | <p> |
| 245 | As a regular user, you can use <c>java-config --set-user-vm</c>. |
245 | As a regular user, you can use <c>java-config --set-user-vm</c>. |
| 246 | </p> |
246 | </p> |
| 247 | |
247 | |
| 248 | <note> |
248 | <note> |
| 249 | You no longer have to <c>source</c> the profile for updates to the user/system |
249 | You no longer have to <c>source</c> the profile for updates to the user/system |
| 250 | VM take place. |
250 | VM take place. |
| 251 | </note> |
251 | </note> |
|
|
252 | |
|
|
253 | </body> |
|
|
254 | </section> |
|
|
255 | <section id="build-only"> |
|
|
256 | <title>Build Only VM</title> |
|
|
257 | <body> |
|
|
258 | |
|
|
259 | <p> |
|
|
260 | Some virtual machines are flagged as build-only due to being EOL and/or |
|
|
261 | containing security vulnerabilities. These virtual machines will not |
|
|
262 | automatically be used by Gentoo for the running of applications using Gentoo |
|
|
263 | launchers but will still be available for use by Gentoo's build environment as |
|
|
264 | some packages may require them for building. The setting of these virtual |
|
|
265 | machines as either your system or user VM is strongly discouraged as these VMs |
|
|
266 | will then be used when running the <path>/usr/bin/{java,javac,..}</path> |
|
|
267 | executables and will also be used by any packages not using Gentoo's launcher |
|
|
268 | scripts. |
|
|
269 | </p> |
| 252 | |
270 | |
| 253 | </body> |
271 | </body> |
| 254 | </section> |
272 | </section> |
| 255 | <section id="preferred-vm"> |
273 | <section id="preferred-vm"> |
| 256 | <title>Preferred VM</title> |
274 | <title>Preferred VM</title> |
| … | |
… | |
| 437 | </p> |
455 | </p> |
| 438 | |
456 | |
| 439 | <p> |
457 | <p> |
| 440 | For users, <c>java-config --set-user-classpath</c> will create |
458 | For users, <c>java-config --set-user-classpath</c> will create |
| 441 | <path>~/.gentoo/java-env-classpath</path>, which you should then source from |
459 | <path>~/.gentoo/java-env-classpath</path>, which you should then source from |
| 442 | your shell's profile. |
460 | your shell's profile. |
| 443 | </p> |
461 | </p> |
| 444 | |
462 | |
| 445 | <pre caption="Sourcing user specific classpath"> |
463 | <pre caption="Sourcing user specific classpath"> |
| 446 | <i>if [[ -f "${HOME}/.gentoo/java-env-classpath" ]]; then |
464 | <i>if [[ -f "${HOME}/.gentoo/java-env-classpath" ]]; then |
| 447 | source ${HOME}/.gentoo/java-env-classpath |
465 | source ${HOME}/.gentoo/java-env-classpath |
| … | |
… | |
| 453 | something like the following to your shell's profile. But we would advise |
471 | something like the following to your shell's profile. But we would advise |
| 454 | against it. |
472 | against it. |
| 455 | </p> |
473 | </p> |
| 456 | |
474 | |
| 457 | <pre caption="Setting classpath"> |
475 | <pre caption="Setting classpath"> |
| 458 | # <i>export CLASSPATH="${CLASSPATH}:$(java-config --classpath log4j,xerces-2)"</i> |
476 | # <i>export CLASSPATH="${CLASSPATH}:$(java-config --classpath log4j,xerces-2)"</i> |
| 459 | </pre> |
477 | </pre> |
| 460 | |
478 | |
| 461 | </body> |
479 | </body> |
| 462 | </section> |
480 | </section> |
| 463 | </chapter> |
481 | </chapter> |
| … | |
… | |
| 485 | plugins by running: |
503 | plugins by running: |
| 486 | </p> |
504 | </p> |
| 487 | |
505 | |
| 488 | <pre caption="Viewing available plugins"> |
506 | <pre caption="Viewing available plugins"> |
| 489 | # <i>eselect java-nsplugin list</i> |
507 | # <i>eselect java-nsplugin list</i> |
| 490 | [1] sun-jre-bin-1.5 |
508 | [1] sun-jre-bin-1.6 |
| 491 | [2] blackdown-jre-1.4.2 |
509 | [2] icedtea6-bin |
| 492 | </pre> |
510 | </pre> |
| 493 | |
511 | |
| 494 | <p> |
512 | <p> |
| 495 | In this example, <c>sun-jre-bin</c> is selected for the browser plugin. |
513 | In this example, <c>sun-jre-bin</c> is selected for the browser plugin. |
| 496 | </p> |
514 | </p> |
| 497 | |
515 | |
| 498 | <pre caption="Selecting a plugin"> |
516 | <pre caption="Selecting a plugin"> |
| 499 | # <i>eselect java-nsplugin set sun-jre-bin-1.5</i> |
517 | # <i>eselect java-nsplugin set sun-jre-bin-1.6</i> |
| 500 | </pre> |
518 | </pre> |
| 501 | |
519 | |
| 502 | <p> |
520 | <p> |
| 503 | Verify that the correct plugin was selected: |
521 | Verify that the correct plugin was selected: |
| 504 | </p> |
522 | </p> |
| 505 | |
523 | |
| 506 | <pre caption="Verifying the correct plugin"> |
524 | <pre caption="Verifying the correct plugin"> |
| 507 | # <i>eselect java-nsplugin list</i> |
525 | # <i>eselect java-nsplugin list</i> |
| 508 | [1] sun-jre-bin-1.5 current |
526 | [1] sun-jre-bin-1.6 current |
| 509 | [2] blackdown-jre-1.4.2 |
527 | [2] icedtea6-bin |
| 510 | </pre> |
528 | </pre> |
| 511 | |
529 | |
| 512 | <p> |
530 | <p> |
| 513 | Java.com also provides a link to <uri |
531 | Java.com also provides a link to <uri |
| 514 | link="http://java.com/en/download/installed.jsp">verify your installed |
532 | link="http://java.com/en/download/installed.jsp">verify your installed |
| … | |
… | |
| 521 | <section> |
539 | <section> |
| 522 | <title>Plugins on multilib systems</title> |
540 | <title>Plugins on multilib systems</title> |
| 523 | <body> |
541 | <body> |
| 524 | |
542 | |
| 525 | <p> |
543 | <p> |
| 526 | If you are running a mixed 64-bit and 32-bit multilib system (for example, on AMD64), |
544 | If you are running a mixed 64-bit and 32-bit multilib system (for example, on |
| 527 | you can only use 32-bit Java plugins. |
545 | AMD64), you can use 64-bit and 32-bit Java plugins. Unless you have a pressing |
| 528 | </p> |
546 | need to run 32-bit Java applications, we recommend using native 64-bit plugins |
| 529 | |
547 | on 64-bit web browsers. |
| 530 | <p> |
548 | </p> |
| 531 | To use a 32-bit plugin, you will need to emerge <c>emul-linux-x86-java</c> with |
549 | |
|
|
550 | <p> |
|
|
551 | There are several native 64-bit browser plugins available. The default JDK/JRE |
|
|
552 | pair, <c>sun-jdk</c> and <c>sun-jre-bin</c>, both include browser plugins. Just |
| 532 | the <c>nsplugin</c> USE flag enabled. |
553 | emerge one of them with the <c>nsplugin</c> USE flag enabled. |
|
|
554 | </p> |
|
|
555 | |
|
|
556 | <pre caption="Installing a 64-bit plugin"> |
|
|
557 | # <i>echo "dev-java/sun-jre-bin nsplugin" >> /etc/portage/package.use</i> |
|
|
558 | # <i>emerge sun-jre-bin</i> |
|
|
559 | </pre> |
|
|
560 | |
|
|
561 | <p> |
|
|
562 | To use a 32-bit plugin on a 32-bit browser, you will need to emerge |
|
|
563 | <c>emul-linux-x86-java</c> with the <c>nsplugin</c> USE flag enabled. |
| 533 | </p> |
564 | </p> |
| 534 | |
565 | |
| 535 | <pre caption="Installing a 32-bit plugin"> |
566 | <pre caption="Installing a 32-bit plugin"> |
| 536 | # <i>echo "app-emulation/emul-linux-x86-java nsplugin" >> /etc/portage/package.use</i> |
567 | # <i>echo "app-emulation/emul-linux-x86-java nsplugin" >> /etc/portage/package.use</i> |
| 537 | # <i>emerge emul-linux-x86-java</i> |
568 | # <i>emerge emul-linux-x86-java</i> |
| … | |
… | |
| 542 | </p> |
573 | </p> |
| 543 | |
574 | |
| 544 | <pre caption="Viewing available plugins"> |
575 | <pre caption="Viewing available plugins"> |
| 545 | # <i>eselect java-nsplugin list</i> |
576 | # <i>eselect java-nsplugin list</i> |
| 546 | Available 32-bit Java browser plugins |
577 | Available 32-bit Java browser plugins |
| 547 | [1] emul-linux-x86-java-1.4.2 |
|
|
| 548 | [2] emul-linux-x86-java-1.5 |
578 | [1] emul-linux-x86-java-1.5 |
|
|
579 | [2] emul-linux-x86-java-1.6 |
|
|
580 | Available 64-bit Java browser plugins |
|
|
581 | [1] icedtea6-bin |
|
|
582 | [2] sun-jre-bin-1.6 |
| 549 | </pre> |
583 | </pre> |
| 550 | |
584 | |
| 551 | <p> |
|
|
| 552 | Although you must select a 32-bit browser (such as <c>mozilla-firefox-bin</c>) |
|
|
| 553 | to use with your 32-bit plugin, the 64-bit version of <c>konqueror</c> uses your |
|
|
| 554 | Java VM directly, so it's possible to use the 64-bit version of <c>blackdown</c> |
|
|
| 555 | with this browser; no further configuration is necessary. |
|
|
| 556 | </p> |
585 | <p> |
| 557 | |
|
|
| 558 | <p> |
|
|
| 559 | Now select the right plugin for your 32-bit browser: |
586 | Now select the right plugin for your browsers: |
| 560 | </p> |
587 | </p> |
| 561 | |
588 | |
| 562 | <pre caption="Selecting plugins"> |
589 | <pre caption="Selecting plugins"> |
|
|
590 | <comment>(Choose the plugins for 32-bit and 64-bit browsers)</comment> |
| 563 | # <i>eselect java-nsplugin set 32bit emul-linux-x86-java-1.5</i> |
591 | # <i>eselect java-nsplugin set 32bit emul-linux-x86-java-1.6</i> |
|
|
592 | # <i>eselect java-nsplugin set 64bit sun-jre-bin-1.6</i> |
| 564 | </pre> |
593 | </pre> |
| 565 | |
594 | |
| 566 | <p> |
595 | <p> |
| 567 | Verify the correct plugin was selected: |
596 | Verify the correct plugin was selected: |
| 568 | </p> |
597 | </p> |
| 569 | |
598 | |
| 570 | <pre caption="Verifying the correct plugin"> |
599 | <pre caption="Verifying the correct plugin"> |
| 571 | # <i>eselect java-nsplugin list</i> |
600 | # <i>eselect java-nsplugin list</i> |
| 572 | Available 32-bit Java browser plugins |
601 | Available 32-bit Java browser plugins |
| 573 | [1] emul-linux-x86-java-1.4.2 |
602 | [1] emul-linux-x86-java-1.5 |
| 574 | [2] emul-linux-x86-java-1.5 current |
603 | [2] emul-linux-x86-java-1.6 current |
|
|
604 | Available 64-bit Java browser plugins |
|
|
605 | [1] icedtea6-bin |
|
|
606 | [2] sun-jre-bin-1.6 current |
| 575 | </pre> |
607 | </pre> |
| 576 | |
608 | |
| 577 | </body> |
609 | </body> |
| 578 | </section> |
610 | </section> |
| 579 | </chapter> |
611 | </chapter> |
| … | |
… | |
| 648 | link="http://news.gmane.org/gmane.linux.gentoo.user">gentoo-user</uri>, and |
680 | link="http://news.gmane.org/gmane.linux.gentoo.user">gentoo-user</uri>, and |
| 649 | <uri |
681 | <uri |
| 650 | link="http://news.gmane.org/gmane.linux.gentoo.devel">gentoo-dev</uri> |
682 | link="http://news.gmane.org/gmane.linux.gentoo.devel">gentoo-dev</uri> |
| 651 | mailing list archives |
683 | mailing list archives |
| 652 | </li> |
684 | </li> |
| 653 | <li>#gentoo and #gentoo-java on irc.freenode.net</li> |
685 | <li> |
|
|
686 | <uri link="irc://irc.gentoo.org/gentoo">#gentoo</uri> and <uri |
|
|
687 | link="irc://irc.gentoo.org/gentoo-java">#gentoo-java</uri> on IRC |
|
|
688 | </li> |
| 654 | <li> |
689 | <li> |
| 655 | <uri |
690 | <uri |
| 656 | link="http://en.wikipedia.org/wiki/Java_programming_language">Wikipedia's |
691 | link="http://en.wikipedia.org/wiki/Java_programming_language">Wikipedia's |
| 657 | entry for Java</uri> |
692 | entry for Java</uri> |
| 658 | </li> |
693 | </li> |