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

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

  ViewVC Help
Powered by ViewVC 1.1.20