/[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.41 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.41 2008/05/23 20:07:51 swift 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.16</version> 27<version>0.22</version>
28<date>2008-01-01</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>
123<!-- 118<!--
124TODO: list free implementations? 119TODO: list free implementations?
125note about not drop-in replacements 120note about not drop-in replacements
126kaffe/sablevm/gcj/jamvm 121kaffe/sablevm/gcj/jamvm
127--> 122-->
128<p>
129The default for Java 1.4 is the Blackdown JRE/JDK pair, as it is freely
130("free as in beer") available without any registration fuss.
131</p>
132
133<p>
134JREs and JDKs from Sun, IBM, and BEA are generally faster, but getting them
135is a bit more work, as you are required to read and accept their license before
136downloading (IBM additionally requires you to register).
137</p>
138
139</body> 123</body>
140</section> 124</section>
141<section> 125<section>
142<title>Installing a JRE/JDKs</title> 126<title>Installing a JRE/JDKs</title>
143<body> 127<body>
147Or 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>.
148</p> 132</p>
149 133
150<p> 134<p>
151In 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
152distro 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
153freely downloadable, without any further hassle. 137freely downloadable, without any further hassle.
154</p> 138</p>
155 139
156<note> 140<note>
157A 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
163<section> 147<section>
164<title>Installing fetch-restricted virtual machines</title> 148<title>Installing fetch-restricted virtual machines</title>
165<body> 149<body>
166 150
167<p> 151<p>
168As 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
169few hoops before installing. Simply emerge the packages as you normally would. 153installing. Simply emerge the packages as you normally would. The ebuilds will
170The ebuilds will then instruct you where to go and what to download. 154then instruct you where to go and what to download.
171</p> 155</p>
172 156
173<p> 157<p>
174You should download the indicated file(s) into 158You should download the indicated file(s) into
175<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
215</p> 199</p>
216 200
217<pre caption="Listing available VMs"> 201<pre caption="Listing available VMs">
218# <i>java-config --list-available-vms</i> 202# <i>java-config --list-available-vms</i>
219The following VMs are available for generation-2: 203The following VMs are available for generation-2:
2201) Blackdown JDK 1.4.2.03 [blackdown-jdk-1.4.2] 2041) IcedTea6-bin 1.4.1 [icedtea6-bin]
2212) 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>
2223) Blackdown 32bit JRE 1.4.2.03 [emul-linux-x86-java-1.4.2]
2234) Sun 32bit JRE 1.5.0.08 [emul-linux-x86-java-1.5]
2245) Kaffe 1.1.7 [kaffe]
225*) Sun JDK 1.5.0.08 [sun-jdk-1.5] 206*) Sun JDK 1.6.0.16 [sun-jdk-1.6]
226</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>
227 215
228<p> 216<p>
229The <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
230set). 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
231particular 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
232--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.
233</p> 221</p>
234 222
235<pre caption="Setting the System VM"> 223<pre caption="Setting the System VM">
236<comment>(By handle (preferred))</comment> 224<comment>(By handle (preferred))</comment>
237# <i>java-config --set-system-vm blackdown-jdk-1.4</i> 225# <i>java-config --set-system-vm sun-jdk-1.6</i>
238Now using blackdown-jdk-1.4 as your generation-2 system JVM 226Now using sun-jdk-1.6 as your generation-2 system JVM
239<comment>(By number)</comment> 227<comment>(By number)</comment>
240# <i>java-config --set-system-vm 6</i> 228# <i>java-config --set-system-vm 3</i>
241Now using sun-jdk-1.5 as your generation-2 system JVM 229Now using sun-jdk-1.6 as your generation-2 system JVM
242</pre> 230</pre>
243 231
244<p> 232<p>
245As 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>.
246</p> 234</p>
247 235
248<note> 236<note>
249You 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
250VM take place. 238VM take place.
251</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>
252 258
253</body> 259</body>
254</section> 260</section>
255<section id="preferred-vm"> 261<section id="preferred-vm">
256<title>Preferred VM</title> 262<title>Preferred VM</title>
292*=sun-jdk-1.5 298*=sun-jdk-1.5
293</pre> 299</pre>
294 300
295<pre caption="Example /etc/java-config-2/build/jdk.conf"> 301<pre caption="Example /etc/java-config-2/build/jdk.conf">
296<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,
297# For 1.4, use blackdown-jdk, and for 1.5, use sun-jdk </comment> 303# For 1.5, use sun-jdk </comment>
2981.3=sun-jdk-1.4 ibm-jdk-bin 3041.3=sun-jdk-1.4 ibm-jdk-bin
2991.4=blackdown-jdk
3001.5=sun-jdk 3051.5=sun-jdk
301</pre> 306</pre>
302 307
303<warn> 308<warn>
304You 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
305unsupported VM, things could possibly break. Bugs reported with a unsupported 310unsupported VM, things could possibly break. Bugs reported with a unsupported VM
306VM won't be prioritized as much as bugs present within supported VMs. 311won't be prioritized as much as bugs present within supported VMs.
307</warn> 312</warn>
308 313
309</body> 314</body>
310</section> 315</section>
311</chapter> 316</chapter>
326<pre caption="/etc/java-config-2/build/compilers.conf"> 331<pre caption="/etc/java-config-2/build/compilers.conf">
327# If the ebuild supports it 332# If the ebuild supports it
328# it will check the COMPILERS var front to back and 333# it will check the COMPILERS var front to back and
329# use the first compiler that is installed 334# use the first compiler that is installed
330 335
331COMPILERS="ecj-3.1 jikes javac" 336COMPILERS="ecj-X.Y jikes javac"
332</pre> 337</pre>
333 338
334<p> 339<p>
335Some compilers don't support all possible -target and -source arguments. 340Some compilers don't support all possible -target and -source arguments.
336Therefore, 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
368 1.5 syntax yet. 373 1.5 syntax yet.
369 </ti> 374 </ti>
370</tr> 375</tr>
371<tr> 376<tr>
372 <ti>Eclipse Compiler for Java</ti> 377 <ti>Eclipse Compiler for Java</ti>
373 <ti>ecj-3.1</ti> 378 <ti>ecj</ti>
374 <ti>=dev-java/eclipse-ecj-3.1*</ti> 379 <ti>dev-java/eclipse-ecj</ti>
375 <ti> 380 <ti>
376 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
377 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.
378 </ti> 383 </ti>
379</tr> 384</tr>
485plugins by running: 490plugins by running:
486</p> 491</p>
487 492
488<pre caption="Viewing available plugins"> 493<pre caption="Viewing available plugins">
489# <i>eselect java-nsplugin list</i> 494# <i>eselect java-nsplugin list</i>
490 [1] sun-jre-bin-1.5 495 [1] sun-jre-bin-1.6
491 [2] blackdown-jre-1.4.2 496 [2] icedtea6-bin
492</pre> 497</pre>
493 498
494<p> 499<p>
495In 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.
496</p> 501</p>
497 502
498<pre caption="Selecting a plugin"> 503<pre caption="Selecting a plugin">
499# <i>eselect java-nsplugin set sun-jre-bin-1.5</i> 504# <i>eselect java-nsplugin set sun-jre-bin-1.6</i>
500</pre> 505</pre>
501 506
502<p> 507<p>
503Verify that the correct plugin was selected: 508Verify that the correct plugin was selected:
504</p> 509</p>
505 510
506<pre caption="Verifying the correct plugin"> 511<pre caption="Verifying the correct plugin">
507# <i>eselect java-nsplugin list</i> 512# <i>eselect java-nsplugin list</i>
508 [1] sun-jre-bin-1.5 current 513 [1] sun-jre-bin-1.6 current
509 [2] blackdown-jre-1.4.2 514 [2] icedtea6-bin
510</pre> 515</pre>
511 516
512<p> 517<p>
513Java.com also provides a link to <uri 518Java.com also provides a link to <uri
514link="http://java.com/en/download/installed.jsp">verify your installed 519link="http://java.com/en/download/installed.jsp">verify your installed
522<title>Plugins on multilib systems</title> 527<title>Plugins on multilib systems</title>
523<body> 528<body>
524 529
525<p> 530<p>
526If you are running a mixed 64-bit and 32-bit multilib system (for example, on 531If you are running a mixed 64-bit and 32-bit multilib system (for example, on
527AMD64), you can only use 32-bit Java plugins. 532AMD64), you can use 64-bit and 32-bit Java plugins. Unless you have a pressing
528</p> 533need to run 32-bit Java applications, we recommend using native 64-bit plugins
529 534on 64-bit web browsers.
530<p> 535</p>
531To 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
532the <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.
533</p> 551</p>
534 552
535<pre caption="Installing a 32-bit plugin"> 553<pre caption="Installing a 32-bit plugin">
536# <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>
537# <i>emerge emul-linux-x86-java</i> 555# <i>emerge emul-linux-x86-java</i>
542</p> 560</p>
543 561
544<pre caption="Viewing available plugins"> 562<pre caption="Viewing available plugins">
545# <i>eselect java-nsplugin list</i> 563# <i>eselect java-nsplugin list</i>
546Available 32-bit Java browser plugins 564Available 32-bit Java browser plugins
547 [1] emul-linux-x86-java-1.4.2
548 [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
549</pre> 570</pre>
550 571
551<p>
552Although you must select a 32-bit browser (such as <c>mozilla-firefox-bin</c>)
553to use with your 32-bit plugin, the 64-bit version of <c>konqueror</c> uses your
554Java VM directly, so it's possible to use the 64-bit version of <c>blackdown</c>
555with this browser; no further configuration is necessary.
556</p> 572<p>
557
558<p>
559Now select the right plugin for your 32-bit browser: 573Now select the right plugin for your browsers:
560</p> 574</p>
561 575
562<pre caption="Selecting plugins"> 576<pre caption="Selecting plugins">
577<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> 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>
564</pre> 580</pre>
565 581
566<p> 582<p>
567Verify the correct plugin was selected: 583Verify the correct plugin was selected:
568</p> 584</p>
569 585
570<pre caption="Verifying the correct plugin"> 586<pre caption="Verifying the correct plugin">
571# <i>eselect java-nsplugin list</i> 587# <i>eselect java-nsplugin list</i>
572Available 32-bit Java browser plugins 588Available 32-bit Java browser plugins
573 [1] emul-linux-x86-java-1.4.2 589 [1] emul-linux-x86-java-1.5
574 [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
575</pre> 594</pre>
576 595
577</body> 596</body>
578</section> 597</section>
579</chapter> 598</chapter>
648 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
649 <uri 668 <uri
650 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>
651 mailing list archives 670 mailing list archives
652 </li> 671 </li>
653 <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>
654 <li> 676 <li>
655 <uri 677 <uri
656 link="http://en.wikipedia.org/wiki/Java_programming_language">Wikipedia's 678 link="http://en.wikipedia.org/wiki/Java_programming_language">Wikipedia's
657 entry for Java</uri> 679 entry for Java</uri>
658 </li> 680 </li>

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

  ViewVC Help
Powered by ViewVC 1.1.20