/[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.33 Revision 1.34
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.33 2006/09/10 22:27:26 nightmorph Exp $ --> 2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/java.xml,v 1.34 2006/10/08 22:52:16 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
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>
11<author title="Author"> 11<author title="Author">
12 <mail link="karltk@gentoo.org">Karl Trygve Kalleberg</mail> 12 <mail link="karltk@gentoo.org">Karl Trygve Kalleberg</mail>
13</author> 13</author>
14<author title="Editor"> 14<author title="Editor">
15 <mail link="nightmorph@gentoo.org">Joshua Saddler</mail> 15 <mail link="nightmorph@gentoo.org">Joshua Saddler</mail>
16</author> 16</author>
17 17
18<abstract> 18<abstract>
19This guide will introduce you to Java and explain how to use Java with Gentoo 19This guide will introduce you to Java and explain how to use Java with Gentoo
20Linux. 20Linux.
21</abstract> 21</abstract>
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.9</version> 27<version>0.10</version>
28<date>2006-09-10</date> 28<date>2006-10-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>
34<body> 34<body>
35 35
36<p> 36<p>
37Java is a programming language developed by engineers of Sun Microsystems. The 37Java is a programming language developed by engineers of Sun Microsystems. The
38language is object-oriented and designed to run on multiple platforms without 38language is object-oriented and designed to run on multiple platforms without
39the need of recompiling code for each platform. Although Java can be compiled 39the need of recompiling code for each platform. Although Java can be compiled
40as a native program, much of Java's popularity can be attributed to its 40as a native program, much of Java's popularity can be attributed to its
41portability, along with other features such as garbage collection. To make 41portability, along with other features such as garbage collection. To make
42platform independence possible the Java compiler compiles the Java code to an 42platform independence possible the Java compiler compiles the Java code to an
43intermediate representation called "Java bytecode" that runs on a JRE (Java 43intermediate representation called "Java bytecode" that runs on a JRE (Java
279 279
280</body> 280</body>
281</section> 281</section>
282<section> 282<section>
283<title>Setting a default virtual machine</title> 283<title>Setting a default virtual machine</title>
284<body> 284<body>
285 285
286<p> 286<p>
287Running the command <c>java-config --list-available-vms</c> will give you a 287Running the command <c>java-config --list-available-vms</c> will give you a
288list of all JREs and JDKs installed on your system. Here is an example of 288list of all JREs and JDKs installed on your system. Here is an example of
289output: 289output:
290</p> 290</p>
291 291
292<pre caption="Listing available VMs"> 292<pre caption="Listing available VMs">
293# <i>java-config --list-available-vms</i> 293# <i>java-config --list-available-vms</i>
2941) Blackdown JDK 1.3.1 [blackdown-jdk-1.3] (/etc/env.d/java/20blackdown-jdk-1.3) 294The following VMs are available for generation-2:
2952) Blackdown JDK 1.4.2.02 [blackdown-jdk-1.4] (/etc/env.d/java/20blackdown-jdk-1.4) 2951) Blackdown JDK 1.4.2.03 [blackdown-jdk-1.4.2]
2963) Blackdown JRE 1.4.2.02 [blackdown-jre-1.4] (/etc/env.d/java/20blackdown-jre-1.4) 2962) Blackdown JRE 1.4.2.03 [blackdown-jre-1.4.2]
2974) IBM JDK 1.4.2 [ibm-jdk-bin-1.4] (/etc/env.d/java/20ibm-jdk-bin-1.4) 2973) Blackdown 32bit JRE 1.4.2.03 [emul-linux-x86-java-1.4.2]
2985) IBM JRE 1.4.2 [ibm-jre-bin-1.4] (/etc/env.d/java/20ibm-jre-bin-1.4) 2984) Sun 32bit JRE 1.5.0.08 [emul-linux-x86-java-1.5]
2996) WebLogic JRockit 1.4.2.05 [jrockit-jdk-bin-1.4] (/etc/env.d/java/20jrockit-jdk-bin-1.4) 2995) Kaffe 1.1.7 [kaffe]
3007) WebLogic JRockit 1.5.0.03 [jrockit-jdk-bin-1.5] (/etc/env.d/java/20jrockit-jdk-bin-1.5) 300*) Sun JDK 1.5.0.08 [sun-jdk-1.5]
3018) Sun JDK 1.3.1.13 [sun-jdk-1.3] (/etc/env.d/java/20sun-jdk-1.3)
3029) Sun JDK 1.4.2.09 [sun-jdk-1.4] (/etc/env.d/java/20sun-jdk-1.4)
303*) Sun JDK 1.5.0.04 [sun-jdk-1.5] (/etc/env.d/java/20sun-jdk-1.5)
30411) Sun JRE 1.4.2.09 [sun-jre-bin-1.4] (/etc/env.d/java/20sun-jre-bin-1.4)
30512) Sun JRE 1.5.0.04 [sun-jre-bin-1.5] (/etc/env.d/java/20sun-jre-bin-1.5)
306</pre> 301</pre>
307 302
308<p> 303<p>
309The <e>*</e> indicates this is the current active vm (system-vm or user-vm when 304The <e>*</e> indicates this is the current active vm (system-vm or user-vm when
310set). The name in the brackets (<e>[]</e>) is the handle or ID for that 305set). The name in the brackets (<e>[]</e>) is the handle or ID for that
311particular VM. You use the handle or the number to <c>java-config 306particular VM. You use the handle or the number to <c>java-config
312--set-system-vm</c>. Here is an example of how to set the system VM. 307--set-system-vm</c>. Here is an example of how to set the system VM.
313</p> 308</p>
314 309
315<pre caption="Setting the System VM"> 310<pre caption="Setting the System VM">
316<comment>(By handle (preferred))</comment> 311<comment>(By handle (preferred))</comment>
317# <i>java-config --set-system-vm blackdown-jdk-1.4</i> 312# <i>java-config --set-system-vm blackdown-jdk-1.4</i>
313Now using blackdown-jdk-1.4 as your generation-2 system JVM
318<comment>(By number)</comment> 314<comment>(By number)</comment>
319# <i>java-config --set-system-vm 2</i> 315# <i>java-config --set-system-vm 6</i>
316Now using sun-jdk-1.5 as your generation-2 system JVM
320</pre> 317</pre>
321 318
322<p> 319<p>
323As a regular user, you can use <c>java-config --set-user-vm</c>. 320As a regular user, you can use <c>java-config --set-user-vm</c>.
324</p> 321</p>
325 322
326<note> 323<note>
327You no longer have to <c>source</c> the profile for updates to the user/system 324You no longer have to <c>source</c> the profile for updates to the user/system
328VM take place. 325VM take place.
329</note> 326</note>
330 327
331</body> 328</body>
332</section> 329</section>
333<section id="preferred-vm"> 330<section id="preferred-vm">
334<title>Preferred VM</title> 331<title>Preferred VM</title>
522 519
523<pre caption="Sourcing user specific classpath"> 520<pre caption="Sourcing user specific classpath">
524<i>if [[ -f "${HOME}/.gentoo/java-env-classpath" ]]; then 521<i>if [[ -f "${HOME}/.gentoo/java-env-classpath" ]]; then
525 source ${HOME}/.gentoo/java-env-classpath 522 source ${HOME}/.gentoo/java-env-classpath
526fi</i> 523fi</i>
527</pre> 524</pre>
528 525
529<p> 526<p>
530If you really want a system wide or user default classpath you can add 527If you really want a system wide or user default classpath you can add
531something like the following to your shell's profile. But we would advise 528something like the following to your shell's profile. But we would advise
532against it. 529against it.
533</p> 530</p>
534 531
535<pre caption="Setting classpath"> 532<pre caption="Setting classpath">
536# <i>export CLASSPATH="${CLASSPATH}:$(java-config --classpath log4j,xerces-2)"</i> 533# <i>export CLASSPATH="${CLASSPATH}:$(java-config --classpath log4j,xerces-2)"</i>
534</pre>
535
536</body>
537</section>
538</chapter>
539
540<chapter>
541<title>Java Browser Plug-ins</title>
542<section>
543<title>Installing a plug-in</title>
544<body>
545
546<p>
547You can install a Java plug-in for your web browser by emerging a Java VM with
548the <c>nsplugin</c> USE flag set.
549</p>
550
551<note>
552<c>nsplugin</c> is not available for all architectures. Check for available
553plug-ins on your arch before trying to install a VM by running <c>emerge -pv
554&lt;java-vm&gt;</c>.
555</note>
556
557<p>
558Portage will allow you to install multiple versions of Java plug-ins, though
559only one will be used by your browser. You can check the list of available
560plug-ins by running:
561</p>
562
563<pre caption="Viewing available plug-ins">
564# <i>eselect java-nsplugin list</i>
565 [1] sun-jre-bin-1.5
566 [2] blackdown-jre-1.4.2
567</pre>
568
569<p>
570In this example, <c>sun-jre-bin</c> is selected for the browser plug-in.
571</p>
572
573<pre caption="Selecting a plug-in">
574# <i>eselect java-nsplugin sun-jre-bin-1.5</i>
575</pre>
576
577<p>
578Verify that the correct plug-in was selected:
579</p>
580
581<pre caption="Verifying the correct plug-in">
582# <i>eselect java-nsplugin list</i>
583 [1] sun-jre-bin-1.5 current
584 [2] blackdown-jre-1.4.2
585</pre>
586
587<p>
588Java.com also provides a link to <uri
589link="http://java.com/en/download/installed.jsp">verify your installed
590plug-in</uri>. Additionally, if you are using a Mozilla-based browser, you can
591verify your Java plug-in by typing <c>about:plugins</c> into the address bar.
592</p>
593
594</body>
595</section>
596<section>
597<title>Plug-ins on multilib systems</title>
598<body>
599
600<p>
601If you are running a mixed 64-bit and 32-bit multilib system (for example, on AMD64),
602you can have both 64-bit and a 32-bit Java plug-ins installed.
603</p>
604
605<p>
606First, check which plug-ins are available:
607</p>
608
609<pre caption="Viewing available plug-ins">
610# <i>eselect java-nsplugin list</i>
611Available 32-bit Java browser plugins
612 [1] emul-linux-x86-java-1.4.2
613 [2] emul-linux-x86-java-1.5
614Available 64-bit Java browser plugins
615 [1] blackdown-jdk-1.4.2
616 [2] blackdown-jre-1.4.2
617</pre>
618
619<p>
620You can select a 32-bit plug-in for a 32-bit browser (for example,
621<c>firefox-bin</c>), and you can select a 64-bit plug-in for your 64-bit
622browser (for example, <c>konqueror</c>).
623</p>
624
625<pre caption="Selecting plug-ins">
626# <i>eselect java-nsplugin set 32bit emul-linux-x86-java-1.4.2</i>
627# <i>eselect java-nsplugin set 64bit blackdown-jdk-1.4.2</i>
628</pre>
629
630<p>
631Verify the correct plug-ins were selected:
632</p>
633
634<pre caption="Verifying the correct plug-ins">
635# <i>eselect java-nsplugin list</i>
636Available 32-bit Java browser plugins
637 [1] emul-linux-x86-java-1.4.2 current
638 [2] emul-linux-x86-java-1.5
639Available 64-bit Java browser plugins
640 [1] blackdown-jdk-1.4.2 current
641 [2] blackdown-jre-1.4.2
537</pre> 642</pre>
538 643
539</body> 644</body>
540</section> 645</section>
541</chapter> 646</chapter>
542 647
543<chapter> 648<chapter>
544<title>USE flags for use with Java</title> 649<title>USE flags for use with Java</title>
545<section> 650<section>
546<title>Setting USE flags</title> 651<title>Setting USE flags</title>
547<body> 652<body>
548 653
549<p> 654<p>
550For more information regarding USE flags, refer to the <uri 655For more information regarding USE flags, refer to the <uri
551link="/doc/en/handbook/handbook-x86.xml?part=2&amp;chap=2">USE flags</uri> 656link="/doc/en/handbook/handbook-x86.xml?part=2&amp;chap=2">USE flags</uri>

Legend:
Removed from v.1.33  
changed lines
  Added in v.1.34

  ViewVC Help
Powered by ViewVC 1.1.20