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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.39 Revision 1.48
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.39 2007/04/29 02:36:16 nightmorph Exp $ --> 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"> 3<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
4 4
5<guide link="/doc/en/java.xml"> 5<guide>
6<title>Gentoo Java Guide</title> 6<title>Gentoo Java Guide</title>
7 7
8<author title="Author"> 8<author title="Author">
9 <mail link="nichoj@gentoo.org">Joshua Nichols</mail> 9 <mail link="nichoj@gentoo.org">Joshua Nichols</mail>
10</author> 10</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.15</version> 27<version>0.22</version>
28<date>2007-04-28</date> 28<date>2009-12-23</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>
98 <th>Vendor</th> 98 <th>Vendor</th>
99 <th>JDK</th> 99 <th>JDK</th>
100 <th>JRE</th> 100 <th>JRE</th>
101</tr> 101</tr>
102<tr> 102<tr>
103 <ti>The Blackdown Java Kit</ti>
104 <ti>dev-java/blackdown-jdk</ti>
105 <ti>dev-java/blackdown-jre</ti>
106</tr>
107<tr>
108 <ti>Sun's Java Kit</ti> 103 <ti>Sun's Java Kit</ti>
109 <ti>dev-java/sun-jdk</ti> 104 <ti>dev-java/sun-jdk</ti>
110 <ti>dev-java/sun-jre-bin</ti> 105 <ti>dev-java/sun-jre-bin</ti>
111</tr> 106</tr>
112<tr> 107<tr>
113 <ti>The IBM Java Kit</ti> 108 <ti>The IBM Java Kit</ti>
114 <ti>dev-java/ibm-jdk-bin</ti> 109 <ti>dev-java/ibm-jdk-bin</ti>
115 <ti>dev-java/ibm-jre-bin</ti> 110 <ti>dev-java/ibm-jre-bin</ti>
116</tr> 111</tr>
117<tr> 112<tr>
118 <ti>The Compaq Java Kit for Alpha/Linux/GNU</ti>
119 <ti>dev-java/compaq-jdk</ti>
120 <ti>dev-java/compaq-jre</ti>
121</tr>
122<tr>
123 <ti>BEA WebLogic's J2SE Development Kit</ti> 113 <ti>BEA WebLogic's J2SE Development Kit</ti>
124 <ti>dev-java/jrockit-jdk-bin</ti> 114 <ti>dev-java/jrockit-jdk-bin</ti>
125</tr> 115</tr>
126</table> 116</table>
127 117
128<!-- 118<!--
129TODO: list free implementations? 119TODO: list free implementations?
130note about not drop-in replacements 120note about not drop-in replacements
131kaffe/sablevm/gcj/jamvm 121kaffe/sablevm/gcj/jamvm
132--> 122-->
133<p>
134The default for Java 1.4 is the Blackdown JRE/JDK pair, as it is freely
135("free as in beer") available without any registration fuss.
136</p>
137
138<p>
139JREs and JDKs from Sun, IBM, and BEA are generally faster, but getting them
140is a bit more work, as you are required to read and accept their license before
141downloading (IBM additionally requires you to register).
142</p>
143
144</body> 123</body>
145</section> 124</section>
146<section> 125<section>
147<title>Installing a JRE/JDKs</title> 126<title>Installing a JRE/JDKs</title>
148<body> 127<body>
152Or to install your profile's default JRE, you can <c>emerge virtual/jre</c>. 131Or to install your profile's default JRE, you can <c>emerge virtual/jre</c>.
153</p> 132</p>
154 133
155<p> 134<p>
156In recent events, Sun has relicensed their JDK and JRE under a more Linux 135In recent events, Sun has relicensed their JDK and JRE under a more Linux
157distro friendly license. As a result, Sun releases Java 1.5 and onwards are 136distro friendly license. As a result, Sun Java 1.5 and onwards are
158freely downloadable, without any further hassle. 137freely downloadable, without any further hassle.
159</p> 138</p>
160 139
161<note> 140<note>
162A JDK also includes a JRE, so if you install a JDK you shouldn't have to also 141A JDK also includes a JRE, so if you install a JDK you shouldn't have to also
168<section> 147<section>
169<title>Installing fetch-restricted virtual machines</title> 148<title>Installing fetch-restricted virtual machines</title>
170<body> 149<body>
171 150
172<p> 151<p>
173As already mentioned, some of the JDKs and JREs require you to jump through a 152Some of the JDKs and JREs require you to jump through a few hoops before
174few hoops before installing. Simply emerge the packages as you normally would. 153installing. Simply emerge the packages as you normally would. The ebuilds will
175The ebuilds will then instruct you where to go and what to download. 154then instruct you where to go and what to download.
176</p> 155</p>
177 156
178<p> 157<p>
179You should download the indicated file(s) into 158You should download the indicated file(s) into
180<path>/usr/portage/distfiles</path>. Once there, you can rerun the emerge 159<path>/usr/portage/distfiles</path>. Once there, you can rerun the emerge
220</p> 199</p>
221 200
222<pre caption="Listing available VMs"> 201<pre caption="Listing available VMs">
223# <i>java-config --list-available-vms</i> 202# <i>java-config --list-available-vms</i>
224The following VMs are available for generation-2: 203The following VMs are available for generation-2:
2251) Blackdown JDK 1.4.2.03 [blackdown-jdk-1.4.2] 2041) IcedTea6-bin 1.4.1 [icedtea6-bin]
2262) Blackdown JRE 1.4.2.03 [blackdown-jre-1.4.2] 2052) Sun JDK 1.5.0.20 [sun-jdk-1.5] <comment>(Build Only)</comment>
2273) Blackdown 32bit JRE 1.4.2.03 [emul-linux-x86-java-1.4.2]
2284) Sun 32bit JRE 1.5.0.08 [emul-linux-x86-java-1.5]
2295) Kaffe 1.1.7 [kaffe]
230*) Sun JDK 1.5.0.08 [sun-jdk-1.5] 206*) Sun JDK 1.6.0.16 [sun-jdk-1.6]
231</pre> 207</pre>
208
209<note>
210VMs marked as Build Only may contain security vulnerabilities and/or be EOL.
211Gentoo recommends not setting these VMs as either your system or user VM.
212Please see <uri link="java.xml#build-only">Build Only VM</uri> for more
213information.
214</note>
232 215
233<p> 216<p>
234The <e>*</e> indicates this is the current active vm (system-vm or user-vm when 217The <e>*</e> indicates this is the current active vm (system-vm or user-vm when
235set). The name in the brackets (<e>[]</e>) is the handle or ID for that 218set). The name in the brackets (<e>[]</e>) is the handle or ID for that
236particular VM. You use the handle or the number to <c>java-config 219particular VM. You use the handle or the number to <c>java-config
237--set-system-vm</c>. Here is an example of how to set the system VM. 220--set-system-vm</c>. Here is an example of how to set the system VM.
238</p> 221</p>
239 222
240<pre caption="Setting the System VM"> 223<pre caption="Setting the System VM">
241<comment>(By handle (preferred))</comment> 224<comment>(By handle (preferred))</comment>
242# <i>java-config --set-system-vm blackdown-jdk-1.4</i> 225# <i>java-config --set-system-vm sun-jdk-1.6</i>
243Now using blackdown-jdk-1.4 as your generation-2 system JVM 226Now using sun-jdk-1.6 as your generation-2 system JVM
244<comment>(By number)</comment> 227<comment>(By number)</comment>
245# <i>java-config --set-system-vm 6</i> 228# <i>java-config --set-system-vm 3</i>
246Now using sun-jdk-1.5 as your generation-2 system JVM 229Now using sun-jdk-1.6 as your generation-2 system JVM
247</pre> 230</pre>
248 231
249<p> 232<p>
250As a regular user, you can use <c>java-config --set-user-vm</c>. 233As a regular user, you can use <c>java-config --set-user-vm</c>.
251</p> 234</p>
252 235
253<note> 236<note>
254You no longer have to <c>source</c> the profile for updates to the user/system 237You no longer have to <c>source</c> the profile for updates to the user/system
255VM take place. 238VM take place.
256</note> 239</note>
240
241</body>
242</section>
243<section id="build-only">
244<title>Build Only VM</title>
245<body>
246
247<p>
248Some virtual machines are flagged as build-only due to being EOL and/or
249containing security vulnerabilities. These virtual machines will not
250automatically be used by Gentoo for the running of applications using Gentoo
251launchers but will still be available for use by Gentoo's build environment as
252some packages may require them for building. The setting of these virtual
253machines as either your system or user VM is strongly discouraged as these VMs
254will then be used when running the <path>/usr/bin/{java,javac,..}</path>
255executables and will also be used by any packages not using Gentoo's launcher
256scripts.
257</p>
257 258
258</body> 259</body>
259</section> 260</section>
260<section id="preferred-vm"> 261<section id="preferred-vm">
261<title>Preferred VM</title> 262<title>Preferred VM</title>
297*=sun-jdk-1.5 298*=sun-jdk-1.5
298</pre> 299</pre>
299 300
300<pre caption="Example /etc/java-config-2/build/jdk.conf"> 301<pre caption="Example /etc/java-config-2/build/jdk.conf">
301<comment># For 1.3 I prefer sun-jdk 1.4 but when it is not available, use ibm-jdk-bin, 302<comment># For 1.3 I prefer sun-jdk 1.4 but when it is not available, use ibm-jdk-bin,
302# For 1.4, use blackdown-jdk, and for 1.5, use sun-jdk </comment> 303# For 1.5, use sun-jdk </comment>
3031.3=sun-jdk-1.4 ibm-jdk-bin 3041.3=sun-jdk-1.4 ibm-jdk-bin
3041.4=blackdown-jdk
3051.5=sun-jdk 3051.5=sun-jdk
306</pre> 306</pre>
307 307
308<warn> 308<warn>
309You do not have to edit this file. If you change these options to use a 309You do not <e>have</e> to edit this file. If you change these options to use a
310unsupported VM, things could possibly break. Bugs reported with a unsupported 310unsupported VM, things could possibly break. Bugs reported with a unsupported VM
311VM won't be prioritized as much as bugs present within supported VMs. 311won't be prioritized as much as bugs present within supported VMs.
312</warn> 312</warn>
313 313
314</body> 314</body>
315</section> 315</section>
316</chapter> 316</chapter>
331<pre caption="/etc/java-config-2/build/compilers.conf"> 331<pre caption="/etc/java-config-2/build/compilers.conf">
332# If the ebuild supports it 332# If the ebuild supports it
333# it will check the COMPILERS var front to back and 333# it will check the COMPILERS var front to back and
334# use the first compiler that is installed 334# use the first compiler that is installed
335 335
336COMPILERS="ecj-3.1 jikes javac" 336COMPILERS="ecj-X.Y jikes javac"
337</pre> 337</pre>
338 338
339<p> 339<p>
340Some compilers don't support all possible -target and -source arguments. 340Some compilers don't support all possible -target and -source arguments.
341Therefore, each compiler in the list is checked to see if it can support the 341Therefore, each compiler in the list is checked to see if it can support the
373 1.5 syntax yet. 373 1.5 syntax yet.
374 </ti> 374 </ti>
375</tr> 375</tr>
376<tr> 376<tr>
377 <ti>Eclipse Compiler for Java</ti> 377 <ti>Eclipse Compiler for Java</ti>
378 <ti>ecj-3.1</ti> 378 <ti>ecj</ti>
379 <ti>=dev-java/eclipse-ecj-3.1*</ti> 379 <ti>dev-java/eclipse-ecj</ti>
380 <ti> 380 <ti>
381 ECJ is the compiler used by the Eclipse software development kit. It is 381 ECJ is the compiler used by the Eclipse software development kit. It is
382 very full featured, and is pretty fast. It does support Java 1.5 syntax. 382 very full featured, and is pretty fast. It does support Java 1.5 syntax.
383 </ti> 383 </ti>
384</tr> 384</tr>
442</p> 442</p>
443 443
444<p> 444<p>
445For users, <c>java-config --set-user-classpath</c> will create 445For users, <c>java-config --set-user-classpath</c> will create
446<path>~/.gentoo/java-env-classpath</path>, which you should then source from 446<path>~/.gentoo/java-env-classpath</path>, which you should then source from
447your shell's profile. 447your shell's profile.
448</p> 448</p>
449 449
450<pre caption="Sourcing user specific classpath"> 450<pre caption="Sourcing user specific classpath">
451<i>if [[ -f "${HOME}/.gentoo/java-env-classpath" ]]; then 451<i>if [[ -f "${HOME}/.gentoo/java-env-classpath" ]]; then
452 source ${HOME}/.gentoo/java-env-classpath 452 source ${HOME}/.gentoo/java-env-classpath
458something like the following to your shell's profile. But we would advise 458something like the following to your shell's profile. But we would advise
459against it. 459against it.
460</p> 460</p>
461 461
462<pre caption="Setting classpath"> 462<pre caption="Setting classpath">
463# <i>export CLASSPATH="${CLASSPATH}:$(java-config --classpath log4j,xerces-2)"</i> 463# <i>export CLASSPATH="${CLASSPATH}:$(java-config --classpath log4j,xerces-2)"</i>
464</pre> 464</pre>
465 465
466</body> 466</body>
467</section> 467</section>
468</chapter> 468</chapter>
490plugins by running: 490plugins by running:
491</p> 491</p>
492 492
493<pre caption="Viewing available plugins"> 493<pre caption="Viewing available plugins">
494# <i>eselect java-nsplugin list</i> 494# <i>eselect java-nsplugin list</i>
495 [1] sun-jre-bin-1.5 495 [1] sun-jre-bin-1.6
496 [2] blackdown-jre-1.4.2 496 [2] icedtea6-bin
497</pre> 497</pre>
498 498
499<p> 499<p>
500In this example, <c>sun-jre-bin</c> is selected for the browser plugin. 500In this example, <c>sun-jre-bin</c> is selected for the browser plugin.
501</p> 501</p>
502 502
503<pre caption="Selecting a plugin"> 503<pre caption="Selecting a plugin">
504# <i>eselect java-nsplugin set sun-jre-bin-1.5</i> 504# <i>eselect java-nsplugin set sun-jre-bin-1.6</i>
505</pre> 505</pre>
506 506
507<p> 507<p>
508Verify that the correct plugin was selected: 508Verify that the correct plugin was selected:
509</p> 509</p>
510 510
511<pre caption="Verifying the correct plugin"> 511<pre caption="Verifying the correct plugin">
512# <i>eselect java-nsplugin list</i> 512# <i>eselect java-nsplugin list</i>
513 [1] sun-jre-bin-1.5 current 513 [1] sun-jre-bin-1.6 current
514 [2] blackdown-jre-1.4.2 514 [2] icedtea6-bin
515</pre> 515</pre>
516 516
517<p> 517<p>
518Java.com also provides a link to <uri 518Java.com also provides a link to <uri
519link="http://java.com/en/download/installed.jsp">verify your installed 519link="http://java.com/en/download/installed.jsp">verify your installed
526<section> 526<section>
527<title>Plugins on multilib systems</title> 527<title>Plugins on multilib systems</title>
528<body> 528<body>
529 529
530<p> 530<p>
531If you are running a mixed 64-bit and 32-bit multilib system (for example, on AMD64), 531If you are running a mixed 64-bit and 32-bit multilib system (for example, on
532you can only use 32-bit Java plugins. 532AMD64), you can use 64-bit and 32-bit Java plugins. Unless you have a pressing
533</p> 533need to run 32-bit Java applications, we recommend using native 64-bit plugins
534 534on 64-bit web browsers.
535<p> 535</p>
536To use a 32-bit plugin, you will need to emerge <c>emul-linux-x86-java</c> with 536
537<p>
538There are several native 64-bit browser plugins available. The default JDK/JRE
539pair, <c>sun-jdk</c> and <c>sun-jre-bin</c>, both include browser plugins. Just
537the <c>nsplugin</c> USE flag enabled. 540emerge one of them with the <c>nsplugin</c> USE flag enabled.
541</p>
542
543<pre caption="Installing a 64-bit plugin">
544# <i>echo "dev-java/sun-jre-bin nsplugin" >> /etc/portage/package.use</i>
545# <i>emerge sun-jre-bin</i>
546</pre>
547
548<p>
549To use a 32-bit plugin on a 32-bit browser, you will need to emerge
550<c>emul-linux-x86-java</c> with the <c>nsplugin</c> USE flag enabled.
538</p> 551</p>
539 552
540<pre caption="Installing a 32-bit plugin"> 553<pre caption="Installing a 32-bit plugin">
541# <i>echo "app-emulation/emul-linux-x86-java nsplugin" >> /etc/portage/package.use</i> 554# <i>echo "app-emulation/emul-linux-x86-java nsplugin" >> /etc/portage/package.use</i>
542# <i>emerge emul-linux-x86-java</i> 555# <i>emerge emul-linux-x86-java</i>
547</p> 560</p>
548 561
549<pre caption="Viewing available plugins"> 562<pre caption="Viewing available plugins">
550# <i>eselect java-nsplugin list</i> 563# <i>eselect java-nsplugin list</i>
551Available 32-bit Java browser plugins 564Available 32-bit Java browser plugins
552 [1] emul-linux-x86-java-1.4.2
553 [2] emul-linux-x86-java-1.5 565 [1] emul-linux-x86-java-1.5
566 [2] emul-linux-x86-java-1.6
567Available 64-bit Java browser plugins
568 [1] icedtea6-bin
569 [2] sun-jre-bin-1.6
554</pre> 570</pre>
555 571
556<p>
557Although you must select a 32-bit browser (such as <c>mozilla-firefox-bin</c>)
558to use with your 32-bit plugin, the 64-bit version of <c>konqueror</c> uses your
559Java VM directly, so it's possible to use the 64-bit version of <c>blackdown</c>
560with this browser; no further configuration is necessary.
561</p> 572<p>
562
563<p>
564Now select the right plugin for your 32-bit browser: 573Now select the right plugin for your browsers:
565</p> 574</p>
566 575
567<pre caption="Selecting plugins"> 576<pre caption="Selecting plugins">
577<comment>(Choose the plugins for 32-bit and 64-bit browsers)</comment>
568# <i>eselect java-nsplugin set 32bit emul-linux-x86-java-1.5</i> 578# <i>eselect java-nsplugin set 32bit emul-linux-x86-java-1.6</i>
579# <i>eselect java-nsplugin set 64bit sun-jre-bin-1.6</i>
569</pre> 580</pre>
570 581
571<p> 582<p>
572Verify the correct plugin was selected: 583Verify the correct plugin was selected:
573</p> 584</p>
574 585
575<pre caption="Verifying the correct plugin"> 586<pre caption="Verifying the correct plugin">
576# <i>eselect java-nsplugin list</i> 587# <i>eselect java-nsplugin list</i>
577Available 32-bit Java browser plugins 588Available 32-bit Java browser plugins
578 [1] emul-linux-x86-java-1.4.2 589 [1] emul-linux-x86-java-1.5
579 [2] emul-linux-x86-java-1.5 current 590 [2] emul-linux-x86-java-1.6 current
591Available 64-bit Java browser plugins
592 [1] icedtea6-bin
593 [2] sun-jre-bin-1.6 current
580</pre> 594</pre>
581 595
582</body> 596</body>
583</section> 597</section>
584</chapter> 598</chapter>
611 <li> 625 <li>
612 The <b>source</b> flag installs a zip of the source code of a package. 626 The <b>source</b> flag installs a zip of the source code of a package.
613 This is traditionally used for IDEs to 'attach' source to the libraries you 627 This is traditionally used for IDEs to 'attach' source to the libraries you
614 are using. 628 are using.
615 </li> 629 </li>
630 <li>The <b>jce</b> flag adds support for the Java Cryptography Engine</li>
616 <li> 631 <li>
617 For Java packages, the <b>doc</b> flag will build API documentation using 632 For Java packages, the <b>doc</b> flag will build API documentation using
618 javadoc. 633 javadoc.
619 </li> 634 </li>
620</ul> 635</ul>
652 link="http://news.gmane.org/gmane.linux.gentoo.user">gentoo-user</uri>, and 667 link="http://news.gmane.org/gmane.linux.gentoo.user">gentoo-user</uri>, and
653 <uri 668 <uri
654 link="http://news.gmane.org/gmane.linux.gentoo.devel">gentoo-dev</uri> 669 link="http://news.gmane.org/gmane.linux.gentoo.devel">gentoo-dev</uri>
655 mailing list archives 670 mailing list archives
656 </li> 671 </li>
657 <li>#gentoo and #gentoo-java on irc.freenode.net</li> 672 <li>
673 <uri link="irc://irc.gentoo.org/gentoo">#gentoo</uri> and <uri
674 link="irc://irc.gentoo.org/gentoo-java">#gentoo-java</uri> on IRC
675 </li>
658 <li> 676 <li>
659 <uri 677 <uri
660 link="http://en.wikipedia.org/wiki/Java_programming_language">Wikipedia's 678 link="http://en.wikipedia.org/wiki/Java_programming_language">Wikipedia's
661 entry for Java</uri> 679 entry for Java</uri>
662 </li> 680 </li>
681 <li>
682 If you have suggestions or questions regarding this document, please email
683 the Gentoo Java team: <mail>java@gentoo.org</mail>
684 </li>
663</ul> 685</ul>
664 686
665</body> 687</body>
666</section> 688</section>
667</chapter> 689</chapter>

Legend:
Removed from v.1.39  
changed lines
  Added in v.1.48

  ViewVC Help
Powered by ViewVC 1.1.20