/[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.10 - (show annotations) (download) (as text)
Sun Nov 16 15:35:59 2003 UTC (10 years, 5 months ago) by swift
Branch: MAIN
Changes since 1.9: +7 -32 lines
File MIME type: application/xml
Fix 17941: caveats arent valid anymore

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

  ViewVC Help
Powered by ViewVC 1.1.20