/[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.1 Revision 1.11
1<?xml version='1.0'?> 1<?xml version="1.0" encoding="UTF-8"?>
2<?xml-stylesheet href="/xsl/guide.xsl" type="text/xsl"?> 2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/java.xml,v 1.11 2003/11/21 18:47:08 neysx Exp $ -->
3<guide> 3<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
4
5<guide link="/doc/en/java.xml">
4<title>Gentoo Java Guide</title> 6<title>Gentoo Java Guide</title>
7
5<author title="Author and Editor"> 8<author title="Author and Editor">
6<mail link="karltk@gentoo.org">Karl Trygve Kalleberg</mail> 9 <mail link="karltk@gentoo.org">Karl Trygve Kalleberg</mail>
10</author>
11<author title="Editor">
12 <mail link="swift@gentoo.org">Sven Vermeulen</mail>
7</author> 13</author>
8 14
9<abstract> 15<abstract>
10Users' and Developers' Guide to Java in Gentoo 16Users' and Developers' Guide to Java in Gentoo
11</abstract> 17</abstract>
12 18
19<license/>
20
13<version>0.1.1</version> 21<version>0.1.3</version>
14<date>June 25, 2002</date> 22<date>November 16, 2003</date>
15 23
16<chapter> 24<chapter>
17
18<title>Installing a JDK/JRE</title> 25<title>Installing a JDK/JRE</title>
19<section> 26<section>
20<title>Overview</title> 27<title>Overview</title>
21<body> 28<body>
29
30<p>
22<p>Gentoo provides numerous JDKs and JREs. The default is the 31Gentoo provides numerous JDKs and JREs. The default is the Blackdown JDK/JRE
23Blackdown JDK/JRE pair, as it is freely (beer) available without any 32pair, as it is freely (beer) available without any registration fuss.
24registration fuss.</p> 33</p>
25 34
35<note>
26<note>As kaffe becomes a JRE/JDK drop-in replacement, that will most 36As kaffe becomes a JRE/JDK drop-in replacement, that will most likely become our
27likely become our default.</note> 37default.
38</note>
28 39
40<p>
29<p>Both the Sun JDK/JRE and the IBM JDK/JRE are generally faster, but 41Both the Sun JDK/JRE and the IBM JDK/JRE are generally faster, but getting them
30getting them is a bit more work, as you are required to read and 42is a bit more work, as you are required to read and accept their license before
31accept their license before downloading (IBM additionally requires you 43downloading (IBM additionally requires you to register).
32to register).</p> 44</p>
33 45
46<p>
34<p>Our ebuilds for the Sun and IBM JDK/JREs will notify you of where 47Our ebuilds for the Sun and IBM JDK/JREs will notify you of where to go to
35to go to download them.</p> 48download them.
49</p>
50
36</body> 51</body>
37</section> 52</section>
38 53
39<section> 54<section>
40<title>Installing the Sun/IBM JDK/JREs</title> 55<title>Installing the Sun/IBM JDK/JREs</title>
41<body> 56<body>
42<p>If you run <c>emerge dev-java/sun-jdk-1.3.1</c> or <c>emerge 57
43dev-java/ibm-jdk-1.3.1</c>, you will be notified that you are required 58<p>
44to download the actual tarballs yourself. This has to do with license 59If you run <c>emerge sun-jdk-1.3.1</c> or <c>emerge ibm-jdk-1.3.1</c>, you will
45restrictions for the Sun JDK/JRE (online click-wrap license) and 60be notified that you are required to download the actual tarballs yourself. This
61has to do with license restrictions for the Sun JDK/JRE (online click-wrap
46registration issues with the IBM JDK/JRE.</p> 62license) and registration issues with the IBM JDK/JRE.
63</p>
47 64
48<note>There is also a dev-java/sun-jdk-1.4.0, but not all packages 65<note>
49work nicely with Java 1.4, so you're on your own if you use the 1.4.0 66There is also a sun-jdk-1.4.0, but not all packages work nicely with Java 1.4,
67so you're on your own if you use the 1.4.0 JDK.
50JDK.</note> 68</note>
51 69
70<p>
52<p>You should download the indicated file(s) into 71You should download the indicated file(s) into
53<path>/usr/portage/distfiles</path>. Once that is done, you can rerun 72<path>/usr/portage/distfiles</path>. Once that is done, you can rerun the emerge
54the emerge command, then the JDK/JRE will be installed properly into 73command, then the JDK/JRE will be installed properly into <path>/opt</path>.
55<path>/opt</path>.</p> 74</p>
75
56</body> 76</body>
57</section> 77</section>
58</chapter> 78</chapter>
59 79
60<chapter> 80<chapter>
61<title>Configuring your JDK/JRE</title> 81<title>Configuring your JDK/JRE</title>
62<section> 82<section>
63<title>Overview</title> 83<title>Overview</title>
64<body> 84<body>
85
86<p>
65<p>Gentoo has the ability to have multiple JDKs and JREs installed 87Gentoo has the ability to have multiple JDKs and JREs installed without them
66without them conflicting. There are a few caveats to this, as noted 88conflicting.
67below.</p> 89</p>
68 90
91<p>
69<p>Using the <c>java-config</c> tool, you can set the system-wide 92Using the <c>java-config</c> tool, you can set the system-wide default if you
70default if you have root access. Users can also use <c>java-config</c> 93have root access. Users can also use <c>java-config</c> to set up their own
71to set up their own personal default, that is different from the 94personal default, that is different from the system-wide default.
72system-wide default.</p> 95</p>
96
73</body> 97</body>
74</section> 98</section>
75 99
76<section> 100<section>
77<title>Setting a default JDK/JRE</title> 101<title>Setting a default JDK/JRE</title>
78<body> 102<body>
103
104<p>
79<p>Running the command <c>java-config --list-available-vms</c> will 105Running the command <c>java-config --list-available-vms</c> will give you a list
80give you a list of all availble JREs and JDKs on your system, thus:</p> 106of all availble JREs and JDKs on your system, thus:
81<pre> 107</p>
108
109<pre caption="Listing available VMs">
82[%1 ~] java-config --list-available-vms 110[%1 ~] java-config --list-available-vms
83[blackdown-jdk-1.3.1] Blackdown JDK 1.3.1 (/etc/env.d/java/20blackdown-jdk-1.3.1) 111[blackdown-jdk-1.3.1] Blackdown JDK 1.3.1 (/etc/env.d/java/20blackdown-jdk-1.3.1)
84[blackdown-jre-1.3.1] Blackdown JRE 1.3.1 (/etc/env.d/java/20blackdown-jre-1.3.1) 112[blackdown-jre-1.3.1] Blackdown JRE 1.3.1 (/etc/env.d/java/20blackdown-jre-1.3.1)
85[ibm-jdk-1.3.0] IBM JDK 1.3.0 (/etc/env.d/java/20ibm-jdk-1.3.0) 113[ibm-jdk-1.3.0] IBM JDK 1.3.0 (/etc/env.d/java/20ibm-jdk-1.3.0)
86[ibm-jdk-1.3.1] IBM JDK 1.3.1 (/etc/env.d/java/20ibm-jdk-1.3.1) 114[ibm-jdk-1.3.1] IBM JDK 1.3.1 (/etc/env.d/java/20ibm-jdk-1.3.1)
87[ibm-jre-1.3.1] IBM JRE 1.3.1 (/etc/env.d/java/20ibm-jre-1.3.1) 115[ibm-jre-1.3.1] IBM JRE 1.3.1 (/etc/env.d/java/20ibm-jre-1.3.1)
88[sun-jdk-1.4.0] Sun JDK 1.4.0 (/etc/env.d/java/20sun-jdk-1.4.0) 116[sun-jdk-1.4.0] Sun JDK 1.4.0 (/etc/env.d/java/20sun-jdk-1.4.0)
89</pre> 117</pre>
118
119<p>
90<p>The name in the brackets <path>"[]"</path> is the handle or ID for 120The name in the brackets <path>"[]"</path> is the handle or ID for that
91that particular VM. You use pass that ID to <c>java-config 121particular VM. You use pass that ID to <c>java-config --set-system-vm</c>, thus:
92--set-system-vm</c>, thus:</p> 122</p>
93<pre> 123
124<pre caption="Setting the System VM">
94[#1 ~] java-config --set-system-vm=ibm-jdk-1.3.1 125[#1 ~] java-config --set-system-vm=ibm-jdk-1.3.1
95Now using IBM JDK 1.3.1 (/etc/env.d/java/20ibm-jdk-1.3.1) 126Now using IBM JDK 1.3.1 (/etc/env.d/java/20ibm-jdk-1.3.1)
96</pre> 127</pre>
97 128
129<note>
98<note>You will have to be root to run --set-system-vm</note> 130You will have to be root to run --set-system-vm.
131</note>
99 132
133<p>
100<p>Once you have issued <c>java-config --set-system-vm</c> with a 134Once you have issued <c>java-config --set-system-vm</c> with a particular VM ID,
101particular VM ID, you will need to regenerate your /etc/profile.env, 135you will need to regenerate your /etc/profile.env, thus:
102thus:</p> 136</p>
103<pre> 137
138<pre caption="Regenerating /etc/profile.env" >
104[#1 ~] env-update 139[#1 ~] env-update
105</pre> 140</pre>
106 141
142<p>
107<p>After this, you will either want to relogin, or resource 143After this, you will either want to relogin, or resource
108<path>/etc/profile</path> into your environment.</p> 144<path>/etc/profile</path> into your environment.
145</p>
109 146
147<p>
110<p>As a regular user, you can use <c>java-config --set-user-vm</c>, 148As a regular user, you can use <c>java-config --set-user-vm</c>, which will
111which will create <path>$HOME/.gentoo/java-env</path> with all 149create <path>$HOME/.gentoo/java-env</path> with all required env vars. You would
112required env vars. You would normally source this from your shell's 150normally source this from your shell's startup script
113startup script (<path>$HOME/.zshenv</path> in my case).</p> 151(<path>$HOME/.zshenv</path> in my case).
152</p>
153
114</body> 154</body>
115</section> 155</section>
116 156
117<section> 157<section>
118<title>Setting a default CLASSPATH</title> 158<title>Setting a default CLASSPATH</title>
119<body> 159<body>
160
161<p>
120<p><c>java-config</c> can also be used to set a system-wide default 162<c>java-config</c> can also be used to set a system-wide default CLASSPATH, and
121CLASSPATH, and of course a user-specific default CLASSPATH.</p> 163of course a user-specific default CLASSPATH.
164</p>
122 165
166<p>
123<p>First you want to list available java libraries that might be 167First you want to list available java libraries that might be interesting to put
124interesting to put in your CLASSPATH, thus:</p> 168in your CLASSPATH, thus:
125<pre> 169</p>
170
171<pre caption="Listing classes">
126[%1 ~] java-config --list-available-packages 172[%1 ~] java-config --list-available-packages
127[ant] No description (/usr/share/ant/classpath.env) 173[ant] No description (/usr/share/ant/classpath.env)
128[java-gnome] No description (/usr/share/java-gnome/classpath.env) 174[java-gnome] No description (/usr/share/java-gnome/classpath.env)
129[java-gtk] No description (/usr/share/java-gtk/classpath.env) 175[java-gtk] No description (/usr/share/java-gtk/classpath.env)
130[log4j] "" (/usr/share/log4j/package.env) 176[log4j] "" (/usr/share/log4j/package.env)
131</pre> 177</pre>
132 178
179<note>
133<note>None of these packages have a proper description. That is 180None of these packages have a proper description. That is something that will be
134something that will be implemented in the not-so-distant 181implemented in the not-so-distant future.
135future.</note> 182</note>
136 183
184<p>
137<p>Again, the name in brackets <path>"[]"</path> are the IDs that you 185Again, the name in brackets <path>"[]"</path> are the IDs that you have to pass
138have to pass to <c>java-config --set-system-classpath</c>, thus:</p> 186to <c>java-config --set-system-classpath</c>, thus:
139<pre> 187</p>
188
189<pre caption="Setting classpaths">
140java-config --set-system-classpath=log4j,java-gtk,java-gnome 190java-config --set-system-classpath=log4j,java-gtk,java-gnome
141</pre> 191</pre>
192
193<note>
142<note>The current directory (.) will not be part of the system classpath, 194The current directory (.) will not be part of the system classpath, as that
143as that should be added in root's login profile.</note> 195should be added in root's login profile.
196</note>
197
198<p>
144<p>Again, you will want to run <c>env-update</c> to update your 199Again, you will want to run <c>env-update</c> to update your system's
145system's environment, and you might also want to relogin or resource 200environment, and you might also want to relogin or resource the
146the <path>/etc/profile</path>.</p> 201<path>/etc/profile</path>.
202</p>
203
204<p>
147<p>For users, <c>java-config --set-user-classpath</c> will create 205For users, <c>java-config --set-user-classpath</c> will create
148<path>$HOME/.gentoo/java-env-classpath</path>, which is automatically 206<path>$HOME/.gentoo/java-env-classpath</path>, which is automatically included
149included by <path>$HOME/.gentoo/java-env</path>.</p> 207by <path>$HOME/.gentoo/java-env</path>.
208</p>
209
150</body> 210</body>
151</section> 211</section>
152</chapter> 212</chapter>
153 213
154<chapter> 214<chapter>
155<title>Additional resources</title> 215<title>Additional resources</title>
156<section> 216<section>
157<title>Off-line resources</title> 217<title>Off-line resources</title>
158<body> 218<body>
219
159<ul> 220<ul>
160<li>java-config man page</li> 221<li>java-config man page</li>
161<li><c>java-config --help</c></li> 222<li><c>java-config --help</c></li>
162<li>The <path>/usr/bin/java-config</path> script itself</li> 223<li>The <path>/usr/bin/java-config</path> script itself</li>
163</ul> 224</ul>
225
164</body> 226</body>
165</section> 227</section>
228
166<section> 229<section>
167<title>Online resources</title> 230<title>Online resources</title>
168<body> 231<body>
232
169<ul> 233<ul>
170<li>The <uri link="http://lists.gentoo.org/pipermail/gentoo-dev/"> 234<li>The <uri link="http://news.gmane.org/gmane.linux.gentoo.devel"
171gentoo-dev </uri>, 235>gentoo-dev</uri>, <uri link="http://news.gmane.org/gmane.linux.gentoo.user"
172<uri link="http://lists.gentoo.org/pipermail/gentoo-user/"> gentoo-user
173</uri> mailing list archives</li> 236>gentoo-user </uri> mailing list archives</li>
174<li>#gentoo on irc.openprojects.net</li> 237<li>#gentoo on irc.openprojects.net</li>
175</ul> 238</ul>
176</body>
177</section>
178</chapter>
179<chapter>
180<title>Caveats</title>
181<section>
182<title>General</title>
183<body>
184<p>If you select a JRE as your default VM, you may not have a
185<c>javac</c> command handy at all times, unless you have manually
186installed a symlink to take care of that.</p>
187 239
188<p>Jikes will be used to compile some of the largest packages, if it
189is available. With time, we hope to be able to compile all
190java-dependent packages with Jikes, so some dependencies on the JDK
191can be replaced with a dependency on the JRE.</p>
192
193<p>With some versions of Portage, doing an <c>emerge --world
194update</c> will install the JDK regardless if whether you have it
195installed before or not. This is a known bug addressed in later
196versions of Portage.</p>
197</body> 240</body>
198</section> 241</section>
199</chapter> 242</chapter>
200</guide> 243</guide>

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.20