/[gentoo]/xml/htdocs/doc/en/java.xml
Gentoo

Contents of /xml/htdocs/doc/en/java.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download) (as text)
Sun Nov 24 18:12:38 2002 UTC (12 years, 1 month ago) by zhen
Branch: MAIN
Changes since 1.3: +230 -176 lines
File MIME type: application/xml
cosmetic changes

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

  ViewVC Help
Powered by ViewVC 1.1.20