/[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.36 Revision 1.44
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.36 2006/10/16 12:18:15 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.12</version> 27<version>0.19</version>
28<date>2006-10-16</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>
45</p> 45</p>
46 46
47<p> 47<p>
48In order to run Java bytecode, one needs to have a JRE (Java Runtime 48In order to run Java bytecode, one needs to have a JRE (Java Runtime
49Environment) installed. A JRE provides core libraries, a platform dependent 49Environment) installed. A JRE provides core libraries, a platform dependent
50Java Virtual Machine, plug-ins for browsers, among other things. A JDK (Java 50Java Virtual Machine, plugins for browsers, among other things. A JDK (Java
51Development Kit) adds programming tools, such as a bytecode compiler and a 51Development Kit) adds programming tools, such as a bytecode compiler and a
52debugger. 52debugger.
53</p> 53</p>
54 54
55</body> 55</body>
113 <ti>The IBM Java Kit</ti> 113 <ti>The IBM Java Kit</ti>
114 <ti>dev-java/ibm-jdk-bin</ti> 114 <ti>dev-java/ibm-jdk-bin</ti>
115 <ti>dev-java/ibm-jre-bin</ti> 115 <ti>dev-java/ibm-jre-bin</ti>
116</tr> 116</tr>
117<tr> 117<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> 118 <ti>BEA WebLogic's J2SE Development Kit</ti>
124 <ti>dev-java/jrockit-jdk-bin</ti> 119 <ti>dev-java/jrockit-jdk-bin</ti>
125</tr> 120</tr>
126</table> 121</table>
127 122
128<!-- 123<!--
129TODO: list free implementations? 124TODO: list free implementations?
130note about not drop-in replacements 125note about not drop-in replacements
131kaffe/sablevm/gcj/jamvm 126kaffe/sablevm/gcj/jamvm
132--> 127-->
133<p> 128<p>
134The default for Java 1.4 is the Blackdown JRE/JDK pair, as it is freely 129The default for Java 1.6 is the Sun JRE/JDK pair.
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> 130</p>
143 131
144</body> 132</body>
145</section> 133</section>
146<section> 134<section>
168<section> 156<section>
169<title>Installing fetch-restricted virtual machines</title> 157<title>Installing fetch-restricted virtual machines</title>
170<body> 158<body>
171 159
172<p> 160<p>
173As already mentioned, some of the JDKs and JREs require you to jump through a 161Some 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. 162installing. Simply emerge the packages as you normally would. The ebuilds will
175The ebuilds will then instruct you where to go and what to download. 163then instruct you where to go and what to download.
176</p> 164</p>
177 165
178<p> 166<p>
179You should download the indicated file(s) into 167You should download the indicated file(s) into
180<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
220</p> 208</p>
221 209
222<pre caption="Listing available VMs"> 210<pre caption="Listing available VMs">
223# <i>java-config --list-available-vms</i> 211# <i>java-config --list-available-vms</i>
224The following VMs are available for generation-2: 212The following VMs are available for generation-2:
2251) Blackdown JDK 1.4.2.03 [blackdown-jdk-1.4.2] 2131) Blackdown JDK 1.4.2.03 [blackdown-jdk-1.4.2] <comment>(Build Only)</comment>
2262) Blackdown JRE 1.4.2.03 [blackdown-jre-1.4.2] 2142) Blackdown JRE 1.4.2.03 [blackdown-jre-1.4.2] <comment>(Build Only)</comment>
2273) Blackdown 32bit JRE 1.4.2.03 [emul-linux-x86-java-1.4.2] 2153) IcedTea6-bin 1.4.1 [icedtea6-bin]
2284) Sun 32bit JRE 1.5.0.08 [emul-linux-x86-java-1.5] 2164) Sun JDK 1.5.0.20 [sun-jdk-1.5] <comment>(Build Only)</comment>
2295) Kaffe 1.1.7 [kaffe]
230*) Sun JDK 1.5.0.08 [sun-jdk-1.5] 217*) Sun JDK 1.6.0.16 [sun-jdk-1.6]
231</pre> 218</pre>
219
220<note>
221VMs marked as Build Only may contain security vulnerabilities and/or be EOL.
222Gentoo recommends not setting these VMs as either your system or user VM.
223Please see <uri link="java.xml#build-only">Build Only VM</uri> for more
224information.
225</note>
232 226
233<p> 227<p>
234The <e>*</e> indicates this is the current active vm (system-vm or user-vm when 228The <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 229set). 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 230particular VM. You use the handle or the number to <c>java-config
239 233
240<pre caption="Setting the System VM"> 234<pre caption="Setting the System VM">
241<comment>(By handle (preferred))</comment> 235<comment>(By handle (preferred))</comment>
242# <i>java-config --set-system-vm blackdown-jdk-1.4</i> 236# <i>java-config --set-system-vm blackdown-jdk-1.4</i>
243Now using blackdown-jdk-1.4 as your generation-2 system JVM 237Now using blackdown-jdk-1.4 as your generation-2 system JVM
238WARNING: blackdown-jdk-1.4 is marked as a build-only JVM. Using this vm is not recommended.
244<comment>(By number)</comment> 239<comment>(By number)</comment>
245# <i>java-config --set-system-vm 6</i> 240# <i>java-config --set-system-vm 5</i>
246Now using sun-jdk-1.5 as your generation-2 system JVM 241Now using sun-jdk-1.6 as your generation-2 system JVM
247</pre> 242</pre>
248 243
249<p> 244<p>
250As a regular user, you can use <c>java-config --set-user-vm</c>. 245As a regular user, you can use <c>java-config --set-user-vm</c>.
251</p> 246</p>
255VM take place. 250VM take place.
256</note> 251</note>
257 252
258</body> 253</body>
259</section> 254</section>
255<section id="build-only">
256<title>Build Only VM</title>
257<body>
258
259<p>
260Some virtual machines are flagged as build-only due to being EOL and/or
261containing security vulnerabilities. These virtual machines will not
262automatically be used by Gentoo for the running of applications using Gentoo
263launchers but will still be available for use by Gentoo's build environment as
264some packages may require them for building. The setting of these virtual
265machines as either your system or user VM is strongly discouraged as these VMs
266will then be used when running the <path>/usr/bin/{java,javac,..}</path>
267executables and will also be used by any packages not using Gentoo's launcher
268scripts.
269</p>
270
271</body>
272</section>
260<section id="preferred-vm"> 273<section id="preferred-vm">
261<title>Preferred VM</title> 274<title>Preferred VM</title>
262<body> 275<body>
263 276
264<p> 277<p>
268<p> 281<p>
269Because of the wide variety of available VMs, we do not have the resources to 282Because of the wide variety of available VMs, we do not have the resources to
270test and verify every package works on all of them. So to ensure that every 283test and verify every package works on all of them. So to ensure that every
271packages merges smoothly, we have defined a list of <e>default/supported 284packages merges smoothly, we have defined a list of <e>default/supported
272VMs</e> per arch. You can find them in 285VMs</e> per arch. You can find them in
273<path>/usr/share/java-config/config/jdk-defaults.conf</path>. When you are 286<path>/usr/share/java-config-2/config/jdk-defaults.conf</path>. When you are
274merging a Java package, and it detects one of the VM in that file is installed, 287merging a Java package, and it detects one of the VM in that file is installed,
275it will automatically use that VM, instead of the system-vm. 288it will automatically use that VM, instead of the system-vm.
276</p> 289</p>
277 290
278<p> 291<p>
442</p> 455</p>
443 456
444<p> 457<p>
445For users, <c>java-config --set-user-classpath</c> will create 458For users, <c>java-config --set-user-classpath</c> will create
446<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
447your shell's profile. 460your shell's profile.
448</p> 461</p>
449 462
450<pre caption="Sourcing user specific classpath"> 463<pre caption="Sourcing user specific classpath">
451<i>if [[ -f "${HOME}/.gentoo/java-env-classpath" ]]; then 464<i>if [[ -f "${HOME}/.gentoo/java-env-classpath" ]]; then
452 source ${HOME}/.gentoo/java-env-classpath 465 source ${HOME}/.gentoo/java-env-classpath
458something like the following to your shell's profile. But we would advise 471something like the following to your shell's profile. But we would advise
459against it. 472against it.
460</p> 473</p>
461 474
462<pre caption="Setting classpath"> 475<pre caption="Setting classpath">
463# <i>export CLASSPATH="${CLASSPATH}:$(java-config --classpath log4j,xerces-2)"</i> 476# <i>export CLASSPATH="${CLASSPATH}:$(java-config --classpath log4j,xerces-2)"</i>
464</pre> 477</pre>
465 478
466</body> 479</body>
467</section> 480</section>
468</chapter>
469
470<chapter> 481</chapter>
482
483<chapter>
471<title>Java Browser Plug-ins</title> 484<title>Java Browser Plugins</title>
472<section> 485<section>
473<title>Installing a plug-in</title> 486<title>Installing a plugin</title>
474<body> 487<body>
475 488
476<p> 489<p>
477You can install a Java plug-in for your web browser by emerging a Java VM with 490You can install a Java plugin for your web browser by emerging a Java VM with
478the <c>nsplugin</c> USE flag set. 491the <c>nsplugin</c> USE flag set.
479</p> 492</p>
480 493
481<note> 494<note>
482<c>nsplugin</c> is not available for all architectures. Check for available 495<c>nsplugin</c> is not available for all architectures. Check for available
483plug-ins on your arch before trying to install a VM by running <c>emerge -pv 496plugins on your arch before trying to install a VM by running <c>emerge -pv
484&lt;java-vm&gt;</c>. 497&lt;java-vm&gt;</c>.
485</note> 498</note>
486 499
487<p> 500<p>
488Portage will allow you to install multiple versions of Java plug-ins, though 501Portage will allow you to install multiple versions of Java plugins, though
489only one will be used by your browser. You can check the list of available 502only one will be used by your browser. You can check the list of available
490plug-ins by running: 503plugins by running:
491</p> 504</p>
492 505
493<pre caption="Viewing available plug-ins"> 506<pre caption="Viewing available plugins">
494# <i>eselect java-nsplugin list</i> 507# <i>eselect java-nsplugin list</i>
495 [1] sun-jre-bin-1.5 508 [1] sun-jre-bin-1.6
496 [2] blackdown-jre-1.4.2 509 [2] icedtea6-bin
497</pre> 510</pre>
498 511
499<p> 512<p>
500In this example, <c>sun-jre-bin</c> is selected for the browser plug-in. 513In this example, <c>sun-jre-bin</c> is selected for the browser plugin.
501</p> 514</p>
502 515
503<pre caption="Selecting a plug-in"> 516<pre caption="Selecting a plugin">
504# <i>eselect java-nsplugin set sun-jre-bin-1.5</i> 517# <i>eselect java-nsplugin set sun-jre-bin-1.6</i>
505</pre> 518</pre>
506 519
507<p> 520<p>
508Verify that the correct plug-in was selected: 521Verify that the correct plugin was selected:
509</p> 522</p>
510 523
511<pre caption="Verifying the correct plug-in"> 524<pre caption="Verifying the correct plugin">
512# <i>eselect java-nsplugin list</i> 525# <i>eselect java-nsplugin list</i>
513 [1] sun-jre-bin-1.5 current 526 [1] sun-jre-bin-1.6 current
514 [2] blackdown-jre-1.4.2 527 [2] icedtea6-bin
515</pre> 528</pre>
516 529
517<p> 530<p>
518Java.com also provides a link to <uri 531Java.com also provides a link to <uri
519link="http://java.com/en/download/installed.jsp">verify your installed 532link="http://java.com/en/download/installed.jsp">verify your installed
520plug-in</uri>. Additionally, if you are using a Mozilla-based browser, you can 533plugin</uri>. Additionally, if you are using a Mozilla-based browser, you can
521verify your Java plug-in by typing <c>about:plugins</c> into the address bar. 534verify your Java plugin by typing <c>about:plugins</c> into the address bar.
522</p> 535</p>
523 536
524</body> 537</body>
525</section>
526<section> 538</section>
539<section>
527<title>Plug-ins on multilib systems</title> 540<title>Plugins on multilib systems</title>
528<body> 541<body>
529 542
530<p> 543<p>
531If you are running a mixed 64-bit and 32-bit multilib system (for example, on AMD64), 544If you are running a mixed 64-bit and 32-bit multilib system (for example, on
532you can have both 64-bit and a 32-bit Java plug-ins installed. 545AMD64), you can use 64-bit and 32-bit Java plugins. Unless you have a pressing
533</p> 546need to run 32-bit Java applications, we recommend using native 64-bit plugins
534 547on 64-bit web browsers.
535<p> 548</p>
549
550<p>
551There are several native 64-bit browser plugins available. The default JDK/JRE
552pair, <c>sun-jdk</c> and <c>sun-jre-bin</c>, both include browser plugins. Just
553emerge 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>
562To 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.
564</p>
565
566<pre caption="Installing a 32-bit plugin">
567# <i>echo "app-emulation/emul-linux-x86-java nsplugin" >> /etc/portage/package.use</i>
568# <i>emerge emul-linux-x86-java</i>
569</pre>
570
571<p>
536First, check which plug-ins are available: 572Next, check which plugins are available:
537</p> 573</p>
538 574
539<pre caption="Viewing available plug-ins"> 575<pre caption="Viewing available plugins">
540# <i>eselect java-nsplugin list</i> 576# <i>eselect java-nsplugin list</i>
541Available 32-bit Java browser plugins 577Available 32-bit Java browser plugins
542 [1] emul-linux-x86-java-1.4.2
543 [2] emul-linux-x86-java-1.5 578 [1] emul-linux-x86-java-1.5
579 [2] emul-linux-x86-java-1.6
544Available 64-bit Java browser plugins 580Available 64-bit Java browser plugins
545 [1] blackdown-jdk-1.4.2 581 [1] icedtea6-bin
546 [2] blackdown-jre-1.4.2 582 [2] sun-jre-bin-1.6
547</pre> 583</pre>
548 584
549<p>
550You can select a 32-bit plug-in for a 32-bit browser (for example,
551<c>firefox-bin</c>), and you can select a 64-bit plug-in for your 64-bit
552browser (for example, <c>konqueror</c>).
553</p> 585<p>
586Now select the right plugin for your browsers:
587</p>
554 588
555<pre caption="Selecting plug-ins"> 589<pre caption="Selecting plugins">
590<comment>(Choose the plugins for 32-bit and 64-bit browsers)</comment>
556# <i>eselect java-nsplugin set 32bit emul-linux-x86-java-1.4.2</i> 591# <i>eselect java-nsplugin set 32bit emul-linux-x86-java-1.6</i>
557# <i>eselect java-nsplugin set 64bit blackdown-jdk-1.4.2</i> 592# <i>eselect java-nsplugin set 64bit sun-jre-bin-1.6</i>
558</pre> 593</pre>
559 594
560<p> 595<p>
561Verify the correct plug-ins were selected: 596Verify the correct plugin was selected:
562</p> 597</p>
563 598
564<pre caption="Verifying the correct plug-ins"> 599<pre caption="Verifying the correct plugin">
565# <i>eselect java-nsplugin list</i> 600# <i>eselect java-nsplugin list</i>
566Available 32-bit Java browser plugins 601Available 32-bit Java browser plugins
567 [1] emul-linux-x86-java-1.4.2 current
568 [2] emul-linux-x86-java-1.5 602 [1] emul-linux-x86-java-1.5
603 [2] emul-linux-x86-java-1.6 current
569Available 64-bit Java browser plugins 604Available 64-bit Java browser plugins
570 [1] blackdown-jdk-1.4.2 current 605 [1] icedtea6-bin
571 [2] blackdown-jre-1.4.2 606 [2] sun-jre-bin-1.6 current
572</pre> 607</pre>
573 608
574</body> 609</body>
575</section> 610</section>
576</chapter> 611</chapter>
603 <li> 638 <li>
604 The <b>source</b> flag installs a zip of the source code of a package. 639 The <b>source</b> flag installs a zip of the source code of a package.
605 This is traditionally used for IDEs to 'attach' source to the libraries you 640 This is traditionally used for IDEs to 'attach' source to the libraries you
606 are using. 641 are using.
607 </li> 642 </li>
643 <li>The <b>jce</b> flag adds support for the Java Cryptography Engine</li>
608 <li> 644 <li>
609 For Java packages, the <b>doc</b> flag will build API documentation using 645 For Java packages, the <b>doc</b> flag will build API documentation using
610 javadoc. 646 javadoc.
611 </li> 647 </li>
612</ul> 648</ul>
644 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
645 <uri 681 <uri
646 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>
647 mailing list archives 683 mailing list archives
648 </li> 684 </li>
649 <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>
650 <li> 689 <li>
651 <uri 690 <uri
652 link="http://en.wikipedia.org/wiki/Java_programming_language">Wikipedia's 691 link="http://en.wikipedia.org/wiki/Java_programming_language">Wikipedia's
653 entry for Java</uri> 692 entry for Java</uri>
654 </li> 693 </li>
694 <li>
695 If you have suggestions or questions regarding this document, please email
696 the Gentoo Java team: <mail>java@gentoo.org</mail>
697 </li>
655</ul> 698</ul>
656 699
657</body> 700</body>
658</section> 701</section>
659</chapter> 702</chapter>

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.44

  ViewVC Help
Powered by ViewVC 1.1.20