/[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.23 Revision 1.29
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.23 2006/06/24 18:28:06 nightmorph Exp $ --> 2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/java.xml,v 1.29 2006/08/09 20:44:33 rane 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="karltk@gentoo.org">Karl Trygve Kalleberg</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="nichoj@gentoo.org">Joshua Nichols</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
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.4</version> 27<version>0.7</version>
28<date>2006-06-24</date> 28<date>2006-08-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>
55</body> 55</body>
56</section> 56</section>
57</chapter> 57</chapter>
58 58
59<chapter> 59<chapter>
60<title>Installing a JRE/JDK</title> 60<title>New Java System</title>
61<section>
62<body>
63
64<p>
65The way Java is handled on Gentoo has recently seen many changes and
66improvements. This has only happened very recently, and as a result, all the
67packages related to it are marked with testing keywords, ie ~x86. This
68document assumes you are using the new system.
69</p>
70
71</body>
72</section>
73<section>
74<title>Keywords</title>
75<body>
76
77<p>
78If you are using the stable tree, i.e. x86, ppc, or amd64 as opposed to ~x86,
79~ppc, or ~amd64, you will need to add some entries to your
80<path>/etc/portage/package.keywords</path>:
81</p>
82
83<pre caption="package.keywords">
84# Core Gentoo/Java Packages
85dev-java/ant-core
86dev-java/ant-tasks
87dev-java/ant
88dev-java/java-config
89dev-java/java-config-wrapper
90dev-java/javatoolkit
91dev-java/sun-jce-bin
92# JDKs
93=dev-java/sun-jdk-1.4*
94=dev-java/sun-jdk-1.5*
95=dev-java/ibm-jdk-bin-1.4*
96=dev-java/ibm-jdk-bin-1.5*
97=dev-java/jrockit-jdk-bin-1.4*
98=dev-java/jrockit-jdk-bin-1.5*
99=dev-java/blackdown-jdk-1.4*
100dev-java/kaffe
101# JREs
102=dev-java/sun-jre-bin-1.4*
103=dev-java/sun-jre-bin-1.5*
104=dev-java/ibm-jre-bin-1.4*
105=dev-java/blackdown-jre-1.4*
106# Virtuals
107virtual/jdk
108virtual/jre
109# Compilers
110dev-java/eclipse-ecj
111dev-java/jikes
112# Documentation
113dev-java/java-sdk-docs
114# Misc packages that have been updated to generation-2,
115# where the generation-1 won't build and/or run properly
116dev-java/lucene
117# These have optional Java support, but need ~arch to function properly
118# with generation-2
119dev-util/subversion
120sys-libs/db
121</pre>
122
123<impo>
124It is crucial that you keyword ALL packages related to the new Java system,
125otherwise you will have problems in the later steps of this guide.
126</impo>
127
128<impo>
129It can't be emphasized enough that you have to have ALL the packages related
130to the new Java system keyworded for it to function properly.
131</impo>
132
133</body>
134</section>
135<section>
136<title>Existing installs</title>
137<body>
138
139<p>
140For existing installs, regardless of if you have installed anything Java
141before, make sure you have followed the <uri
142link="/proj/en/java/java-upgrade.xml">Java Upgrade Guide</uri>.
143</p>
144
145</body>
146</section>
147<section>
148<title>New installs</title>
149<body>
150
151<p>
152New installs should require no further preparation.
153</p>
154
155</body>
156</section>
157</chapter>
158
159<chapter>
160<title>Installing a Virtual Machine</title>
61<section> 161<section>
62<title>The choices</title> 162<title>The choices</title>
63<body> 163<body>
64 164
65<p> 165<p>
66Gentoo provides numerous JREs and JDKs. Among the current alternatives, we 166Gentoo provides numerous Runtime Environments (JREs) and Development Kits
67have: 167(JDKs). Among the current choices, we have:
68</p> 168</p>
69 169
70<table> 170<table>
71<tr> 171<tr>
72 <th>Vendor</th> 172 <th>Vendor</th>
73 <th>JDK</th> 173 <th>JDK</th>
74 <th>JRE</th> 174 <th>JRE</th>
75</tr> 175</tr>
76<tr> 176<tr>
77 <ti>The Blackdown Java Kit</ti> 177 <ti>The Blackdown Java Kit</ti>
78 <ti>dev-java/backdown-jdk</ti> 178 <ti>dev-java/blackdown-jdk</ti>
79 <ti>dev-java/blackdown-jre</ti> 179 <ti>dev-java/blackdown-jre</ti>
80</tr> 180</tr>
81<tr> 181<tr>
82 <ti>Sun's Java Kit</ti> 182 <ti>Sun's Java Kit</ti>
83 <ti>dev-java/sun-jdk</ti> 183 <ti>dev-java/sun-jdk</ti>
98 <ti>dev-java/jrockit-jdk-bin</ti> 198 <ti>dev-java/jrockit-jdk-bin</ti>
99</tr> 199</tr>
100</table> 200</table>
101 201
102<!-- 202<!--
103TODO: list free implmentations? 203TODO: list free implementations?
104note about not drop-in replacemenets 204note about not drop-in replacements
105kaffe/sablevm/gcj/jamvm 205kaffe/sablevm/gcj/jamvm
106--> 206-->
107 207
108<p> 208<p>
109The default is Blackdown for both the JRE and the JDK, as it is freely ("free 209The default is Blackdown for both the JRE and the JDK, as it is freely ("free
110as in beer") available without any registration fuss. 210as in beer") available without any registration fuss.
111</p> 211</p>
112 212
113<p> 213<p>
114Both the Sun and the IBM are generally faster, but getting them is a bit more 214The default for Java 1.4 is the Blackdown JRE/JDK pair, as it is freely
115hassle, as you are required to read and accept their license before downloading 215("free as in beer") available without any registration fuss.
216</p>
217
218<p>
219JREs and JDKs from Sun, IBM, and BEA are generally faster, but getting them
220is a bit more work, as you are required to read and accept their license before
116(IBM additionally requires you to register). 221downloading (IBM additionally requires you to register).
117</p>
118
119<p>
120Our ebuilds for the Sun and IBM JRE/JDKs will inform you how to download the
121appropriate files.
122</p> 222</p>
123 223
124</body> 224</body>
125</section> 225</section>
126<section> 226<section>
128<body> 228<body>
129 229
130<p> 230<p>
131To install your profile's default JDK, you can run <c>emerge virtual/jdk</c>. 231To install your profile's default JDK, you can run <c>emerge virtual/jdk</c>.
132Or to install your profile's default JRE, you can <c>emerge virtual/jre</c>. 232Or to install your profile's default JRE, you can <c>emerge virtual/jre</c>.
233</p>
234
235<p>
236In recent events, Sun has relicensed their JDK and JRE under a more Linux
237distro friendly license. As a result, Sun releases Java 1.5 and onwards are
238freely downloadable, without any further hassle.
133</p> 239</p>
134 240
135<note> 241<note>
136A JDK also includes a JRE, so if you install a JDK you shouldn't have to also 242A JDK also includes a JRE, so if you install a JDK you shouldn't have to also
137have to install a JRE. 243have to install a JRE.
138</note> 244</note>
139 245
140</body> 246</body>
141</section> 247</section>
142<section> 248<section>
143<title>Installing the Sun/IBM JRE/JDKs</title> 249<title>Installing fetch-restricted virtual machines</title>
144<body> 250<body>
145 251
146<p> 252<p>
147If you run <c>emerge dev-java/sun-jdk</c> or <c>emerge 253As already mentioned, some of the JDKs and JREs require you to jump through a
148dev-java/ibm-jdk-bin</c>, you will be notified that you are required to 254few hoops before installing. Simply emerge the packages as you normally would.
149download the actual files yourself. This has to do with license restrictions 255The ebuilds will then instruct you where to go and what to download.
150for the Sun JRE/JDK (online click-wrap license) and registration issues with
151the IBM JRE/JDK.
152</p> 256</p>
153 257
154<p> 258<p>
155You should download the indicated file(s) into 259You should download the indicated file(s) into
156<path>/usr/portage/distfiles</path>. Once there, you can rerun the emerge 260<path>/usr/portage/distfiles</path>. Once there, you can rerun the emerge
160</body> 264</body>
161</section> 265</section>
162</chapter> 266</chapter>
163 267
164<chapter> 268<chapter>
165<title>Configuring your JRE/JDK</title> 269<title>Configuring your virtual machine</title>
166<section> 270<section>
167<title>Overview</title> 271<title>Overview</title>
168<body> 272<body>
169 273
170<p> 274<p>
178up their own personal default. 282up their own personal default.
179</p> 283</p>
180 284
181<note> 285<note>
182You can also use <e>eselect</e> to change the system and user vm. See 286You can also use <e>eselect</e> to change the system and user vm. See
183<c>eselect java help</c>. 287<c>eselect java-vm help</c>.
184</note> 288</note>
185 289
186</body> 290</body>
187</section> 291</section>
188<section> 292<section>
189<title>Setting a default JRE/JDK</title> 293<title>Setting a default virtual machine</title>
190<body> 294<body>
191 295
192<p> 296<p>
193Running the command <c>java-config --list-available-vms</c> will give you a 297Running the command <c>java-config --list-available-vms</c> will give you a
194list of all JREs and JDKs installed on your system. Here is an example of 298list of all JREs and JDKs installed on your system. Here is an example of
285</pre> 389</pre>
286 390
287<warn> 391<warn>
288You do not have to edit this file. If you change these options to use a 392You do not have to edit this file. If you change these options to use a
289unsupported VM, things could possibly break. Bugs reported with a unsupported 393unsupported VM, things could possibly break. Bugs reported with a unsupported
290VM will a lower priority if they aren't present with supported VMs. 394VM won't be prioritized as much as bugs present within supported VMs.
291</warn> 395</warn>
292 396
293</body> 397</body>
294</section> 398</section>
295</chapter> 399</chapter>
372<section> 476<section>
373<body> 477<body>
374 478
375<warn> 479<warn>
376The options explained in this section should be considered deprecated and will 480The options explained in this section should be considered deprecated and will
377be most likely be removed in the future. We strongly recommend against using 481most likely be removed in the future. We strongly recommend against using
378these, because your Java projects or application should ideally manage their 482these, because your Java projects or application should ideally manage their
379own classpaths. If you choose to specify a default CLASSPATH, some applications 483own classpaths. If you choose to specify a default CLASSPATH, some applications
380may behave unexpectedly, because classes they weren't expecting would be on the 484may behave unexpectedly, because classes they weren't expecting would be on the
381classpath. 485classpath.
382</warn> 486</warn>
414The current directory (<path>.</path>) will not be part of the system 518The current directory (<path>.</path>) will not be part of the system
415classpath, as that should be added in your system's login profile. 519classpath, as that should be added in your system's login profile.
416</note> 520</note>
417 521
418<p> 522<p>
419You will have to update your environment by relogging in or sourcing 523You will have to update your environment by logging out, then in again or
420<path>/etc/profile</path>. 524sourcing <path>/etc/profile</path>.
421</p> 525</p>
422 526
423<p> 527<p>
424For users, <c>java-config --set-user-classpath</c> will create 528For users, <c>java-config --set-user-classpath</c> will create
425<path>~/.gentoo/java-env-classpath</path>, which you should then source from 529<path>~/.gentoo/java-env-classpath</path>, which you should then source from
432fi</i> 536fi</i>
433</pre> 537</pre>
434 538
435<p> 539<p>
436If you really want a system wide or user default classpath you can add 540If you really want a system wide or user default classpath you can add
437something like like the following to your shell's profile. But we would advise 541something like the following to your shell's profile. But we would advise
438against it. 542against it.
439</p> 543</p>
440 544
441<pre caption="Setting classpath"> 545<pre caption="Setting classpath">
442# <i>export CLASSPATH="${CLASSPATH}:$(java-config --classpath log4j,xerces-2)"</i> 546# <i>export CLASSPATH="${CLASSPATH}:$(java-config --classpath log4j,xerces-2)"</i>
477 </li> 581 </li>
478 <li> 582 <li>
479 The <b>source</b> flag will install a zip of the package's source code. 583 The <b>source</b> flag will install a zip of the package's source code.
480 This is typically used to provide your IDE with the source code for the 584 This is typically used to provide your IDE with the source code for the
481 package. 585 package.
586 </li>
587 <li>
588 The <b>source</b> flag installs a zip of the source code of a package.
589 This is traditionally used for for IDEs to 'attach' source to the libraries
590 you are using.
591 </li>
592 <li>
593 For Java packages, the <b>doc</b> flag will build API documentation using
594 javadoc.
482 </li> 595 </li>
483</ul> 596</ul>
484 597
485</body> 598</body>
486</section> 599</section>

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.29

  ViewVC Help
Powered by ViewVC 1.1.20