| 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.24 2006/06/24 19:06:34 nightmorph Exp $ --> |
2 | <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/java.xml,v 1.48 2010/03/31 23:38:40 nightmorph 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> |
| 6 | <title>Gentoo Java Guide</title> |
6 | <title>Gentoo Java Guide</title> |
| 7 | |
7 | |
|
|
8 | <author title="Author"> |
|
|
9 | <mail link="nichoj@gentoo.org">Joshua Nichols</mail> |
|
|
10 | </author> |
| 8 | <author title="Author"> |
11 | <author title="Author"> |
| 9 | <mail link="karltk@gentoo.org">Karl Trygve Kalleberg</mail> |
12 | <mail link="karltk@gentoo.org">Karl Trygve Kalleberg</mail> |
| 10 | </author> |
|
|
| 11 | <author title="Author"> |
|
|
| 12 | <mail link="nichoj@gentoo.org">Joshua Nichols</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.22</version> |
| 28 | <date>2006-06-24</date> |
28 | <date>2009-12-23</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> |
| … | |
… | |
| 45 | </p> |
45 | </p> |
| 46 | |
46 | |
| 47 | <p> |
47 | <p> |
| 48 | In order to run Java bytecode, one needs to have a JRE (Java Runtime |
48 | In order to run Java bytecode, one needs to have a JRE (Java Runtime |
| 49 | Environment) installed. A JRE provides core libraries, a platform dependent |
49 | Environment) installed. A JRE provides core libraries, a platform dependent |
| 50 | Java Virtual Machine, plug-ins for browsers, among other things. A JDK (Java |
50 | Java Virtual Machine, plugins for browsers, among other things. A JDK (Java |
| 51 | Development Kit) adds programming tools, such as a bytecode compiler and a |
51 | Development Kit) adds programming tools, such as a bytecode compiler and a |
| 52 | debugger. |
52 | debugger. |
| 53 | </p> |
53 | </p> |
| 54 | |
54 | |
| 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>Before You Begin</title> |
|
|
61 | <section> |
|
|
62 | <title>Existing installs</title> |
|
|
63 | <body> |
|
|
64 | |
|
|
65 | <p> |
|
|
66 | For existing installs, regardless of if you have installed anything Java |
|
|
67 | before, make sure you have followed the <uri |
|
|
68 | link="/proj/en/java/java-upgrade.xml">Java Upgrade Guide</uri>. |
|
|
69 | </p> |
|
|
70 | |
|
|
71 | </body> |
|
|
72 | </section> |
|
|
73 | <section> |
|
|
74 | <title>New installs</title> |
|
|
75 | <body> |
|
|
76 | |
|
|
77 | <p> |
|
|
78 | New installs should require no further preparation. |
|
|
79 | </p> |
|
|
80 | |
|
|
81 | </body> |
|
|
82 | </section> |
|
|
83 | </chapter> |
|
|
84 | |
|
|
85 | <chapter> |
|
|
86 | <title>Installing a Virtual Machine</title> |
| 61 | <section> |
87 | <section> |
| 62 | <title>The choices</title> |
88 | <title>The choices</title> |
| 63 | <body> |
89 | <body> |
| 64 | |
90 | |
| 65 | <p> |
91 | <p> |
| 66 | Gentoo provides numerous JREs and JDKs. Among the current alternatives, we |
92 | Gentoo provides numerous Runtime Environments (JREs) and Development Kits |
| 67 | have: |
93 | (JDKs). Among the current choices, we have: |
| 68 | </p> |
94 | </p> |
| 69 | |
95 | |
| 70 | <table> |
96 | <table> |
| 71 | <tr> |
97 | <tr> |
| 72 | <th>Vendor</th> |
98 | <th>Vendor</th> |
| 73 | <th>JDK</th> |
99 | <th>JDK</th> |
| 74 | <th>JRE</th> |
100 | <th>JRE</th> |
| 75 | </tr> |
101 | </tr> |
| 76 | <tr> |
102 | <tr> |
| 77 | <ti>The Blackdown Java Kit</ti> |
|
|
| 78 | <ti>dev-java/backdown-jdk</ti> |
|
|
| 79 | <ti>dev-java/blackdown-jre</ti> |
|
|
| 80 | </tr> |
|
|
| 81 | <tr> |
|
|
| 82 | <ti>Sun's Java Kit</ti> |
103 | <ti>Sun's Java Kit</ti> |
| 83 | <ti>dev-java/sun-jdk</ti> |
104 | <ti>dev-java/sun-jdk</ti> |
| 84 | <ti>dev-java/sun-jre-bin</ti> |
105 | <ti>dev-java/sun-jre-bin</ti> |
| 85 | </tr> |
106 | </tr> |
| 86 | <tr> |
107 | <tr> |
| 87 | <ti>The IBM Java Kit</ti> |
108 | <ti>The IBM Java Kit</ti> |
| 88 | <ti>dev-java/ibm-jdk-bin</ti> |
109 | <ti>dev-java/ibm-jdk-bin</ti> |
| 89 | <ti>dev-java/ibm-jre-bin</ti> |
110 | <ti>dev-java/ibm-jre-bin</ti> |
| 90 | </tr> |
111 | </tr> |
| 91 | <tr> |
112 | <tr> |
| 92 | <ti>The Compaq Java Kit for Alpha/Linux/GNU</ti> |
|
|
| 93 | <ti>dev-java/compaq-jdk</ti> |
|
|
| 94 | <ti>dev-java/compaq-jre</ti> |
|
|
| 95 | </tr> |
|
|
| 96 | <tr> |
|
|
| 97 | <ti>BEA WebLogic's J2SE Development Kit</ti> |
113 | <ti>BEA WebLogic's J2SE Development Kit</ti> |
| 98 | <ti>dev-java/jrockit-jdk-bin</ti> |
114 | <ti>dev-java/jrockit-jdk-bin</ti> |
| 99 | </tr> |
115 | </tr> |
| 100 | </table> |
116 | </table> |
| 101 | |
117 | |
| 102 | <!-- |
118 | <!-- |
| 103 | TODO: list free implmentations? |
119 | TODO: list free implementations? |
| 104 | note about not drop-in replacemenets |
120 | note about not drop-in replacements |
| 105 | kaffe/sablevm/gcj/jamvm |
121 | kaffe/sablevm/gcj/jamvm |
| 106 | --> |
122 | --> |
| 107 | |
|
|
| 108 | <p> |
|
|
| 109 | The default is Blackdown for both the JRE and the JDK, as it is freely ("free |
|
|
| 110 | as in beer") available without any registration fuss. |
|
|
| 111 | </p> |
|
|
| 112 | |
|
|
| 113 | <p> |
|
|
| 114 | Both the Sun and the IBM are generally faster, but getting them is a bit more |
|
|
| 115 | hassle, as you are required to read and accept their license before downloading |
|
|
| 116 | (IBM additionally requires you to register). |
|
|
| 117 | </p> |
|
|
| 118 | |
|
|
| 119 | <p> |
|
|
| 120 | Our ebuilds for the Sun and IBM JRE/JDKs will inform you how to download the |
|
|
| 121 | appropriate files. |
|
|
| 122 | </p> |
|
|
| 123 | |
|
|
| 124 | </body> |
123 | </body> |
| 125 | </section> |
124 | </section> |
| 126 | <section> |
125 | <section> |
| 127 | <title>Installing a JRE/JDKs</title> |
126 | <title>Installing a JRE/JDKs</title> |
| 128 | <body> |
127 | <body> |
| 129 | |
128 | |
| 130 | <p> |
129 | <p> |
| 131 | To install your profile's default JDK, you can run <c>emerge virtual/jdk</c>. |
130 | To install your profile's default JDK, you can run <c>emerge virtual/jdk</c>. |
| 132 | Or to install your profile's default JRE, you can <c>emerge virtual/jre</c>. |
131 | Or to install your profile's default JRE, you can <c>emerge virtual/jre</c>. |
|
|
132 | </p> |
|
|
133 | |
|
|
134 | <p> |
|
|
135 | In recent events, Sun has relicensed their JDK and JRE under a more Linux |
|
|
136 | distro friendly license. As a result, Sun Java 1.5 and onwards are |
|
|
137 | freely downloadable, without any further hassle. |
| 133 | </p> |
138 | </p> |
| 134 | |
139 | |
| 135 | <note> |
140 | <note> |
| 136 | A JDK also includes a JRE, so if you install a JDK you shouldn't have to also |
141 | A JDK also includes a JRE, so if you install a JDK you shouldn't have to also |
| 137 | have to install a JRE. |
142 | have to install a JRE. |
| 138 | </note> |
143 | </note> |
| 139 | |
144 | |
| 140 | </body> |
145 | </body> |
| 141 | </section> |
146 | </section> |
| 142 | <section> |
147 | <section> |
| 143 | <title>Installing the Sun/IBM JRE/JDKs</title> |
148 | <title>Installing fetch-restricted virtual machines</title> |
| 144 | <body> |
149 | <body> |
| 145 | |
150 | |
| 146 | <p> |
151 | <p> |
| 147 | If you run <c>emerge dev-java/sun-jdk</c> or <c>emerge |
152 | Some of the JDKs and JREs require you to jump through a few hoops before |
| 148 | dev-java/ibm-jdk-bin</c>, you will be notified that you are required to |
153 | installing. Simply emerge the packages as you normally would. The ebuilds will |
| 149 | download the actual files yourself. This has to do with license restrictions |
154 | then instruct you where to go and what to download. |
| 150 | for the Sun JRE/JDK (online click-wrap license) and registration issues with |
|
|
| 151 | the IBM JRE/JDK. |
|
|
| 152 | </p> |
155 | </p> |
| 153 | |
156 | |
| 154 | <p> |
157 | <p> |
| 155 | You should download the indicated file(s) into |
158 | You should download the indicated file(s) into |
| 156 | <path>/usr/portage/distfiles</path>. Once there, you can rerun the emerge |
159 | <path>/usr/portage/distfiles</path>. Once there, you can rerun the emerge |
| … | |
… | |
| 160 | </body> |
163 | </body> |
| 161 | </section> |
164 | </section> |
| 162 | </chapter> |
165 | </chapter> |
| 163 | |
166 | |
| 164 | <chapter> |
167 | <chapter> |
| 165 | <title>Configuring your JRE/JDK</title> |
168 | <title>Configuring your virtual machine</title> |
| 166 | <section> |
169 | <section> |
| 167 | <title>Overview</title> |
170 | <title>Overview</title> |
| 168 | <body> |
171 | <body> |
| 169 | |
172 | |
| 170 | <p> |
173 | <p> |
| … | |
… | |
| 184 | </note> |
187 | </note> |
| 185 | |
188 | |
| 186 | </body> |
189 | </body> |
| 187 | </section> |
190 | </section> |
| 188 | <section> |
191 | <section> |
| 189 | <title>Setting a default JRE/JDK</title> |
192 | <title>Setting a default virtual machine</title> |
| 190 | <body> |
193 | <body> |
| 191 | |
194 | |
| 192 | <p> |
195 | <p> |
| 193 | Running the command <c>java-config --list-available-vms</c> will give you a |
196 | Running the command <c>java-config --list-available-vms</c> will give you a |
| 194 | list of all JREs and JDKs installed on your system. Here is an example of |
197 | list of all JREs and JDKs installed on your system. Here is an example of |
| 195 | output: |
198 | output: |
| 196 | </p> |
199 | </p> |
| 197 | |
200 | |
| 198 | <pre caption="Listing available VMs"> |
201 | <pre caption="Listing available VMs"> |
| 199 | # <i>java-config --list-available-vms</i> |
202 | # <i>java-config --list-available-vms</i> |
| 200 | 1) Blackdown JDK 1.3.1 [blackdown-jdk-1.3] (/etc/env.d/java/20blackdown-jdk-1.3) |
203 | The following VMs are available for generation-2: |
| 201 | 2) Blackdown JDK 1.4.2.02 [blackdown-jdk-1.4] (/etc/env.d/java/20blackdown-jdk-1.4) |
204 | 1) IcedTea6-bin 1.4.1 [icedtea6-bin] |
| 202 | 3) Blackdown JRE 1.4.2.02 [blackdown-jre-1.4] (/etc/env.d/java/20blackdown-jre-1.4) |
205 | 2) Sun JDK 1.5.0.20 [sun-jdk-1.5] <comment>(Build Only)</comment> |
| 203 | 4) IBM JDK 1.4.2 [ibm-jdk-bin-1.4] (/etc/env.d/java/20ibm-jdk-bin-1.4) |
206 | *) Sun JDK 1.6.0.16 [sun-jdk-1.6] |
| 204 | 5) IBM JRE 1.4.2 [ibm-jre-bin-1.4] (/etc/env.d/java/20ibm-jre-bin-1.4) |
|
|
| 205 | 6) WebLogic JRockit 1.4.2.05 [jrockit-jdk-bin-1.4] (/etc/env.d/java/20jrockit-jdk-bin-1.4) |
|
|
| 206 | 7) WebLogic JRockit 1.5.0.03 [jrockit-jdk-bin-1.5] (/etc/env.d/java/20jrockit-jdk-bin-1.5) |
|
|
| 207 | 8) Sun JDK 1.3.1.13 [sun-jdk-1.3] (/etc/env.d/java/20sun-jdk-1.3) |
|
|
| 208 | 9) Sun JDK 1.4.2.09 [sun-jdk-1.4] (/etc/env.d/java/20sun-jdk-1.4) |
|
|
| 209 | *) Sun JDK 1.5.0.04 [sun-jdk-1.5] (/etc/env.d/java/20sun-jdk-1.5) |
|
|
| 210 | 11) Sun JRE 1.4.2.09 [sun-jre-bin-1.4] (/etc/env.d/java/20sun-jre-bin-1.4) |
|
|
| 211 | 12) Sun JRE 1.5.0.04 [sun-jre-bin-1.5] (/etc/env.d/java/20sun-jre-bin-1.5) |
|
|
| 212 | </pre> |
207 | </pre> |
|
|
208 | |
|
|
209 | <note> |
|
|
210 | VMs marked as Build Only may contain security vulnerabilities and/or be EOL. |
|
|
211 | Gentoo recommends not setting these VMs as either your system or user VM. |
|
|
212 | Please see <uri link="java.xml#build-only">Build Only VM</uri> for more |
|
|
213 | information. |
|
|
214 | </note> |
| 213 | |
215 | |
| 214 | <p> |
216 | <p> |
| 215 | The <e>*</e> indicates this is the current active vm (system-vm or user-vm when |
217 | The <e>*</e> indicates this is the current active vm (system-vm or user-vm when |
| 216 | set). The name in the brackets (<e>[]</e>) is the handle or ID for that |
218 | set). The name in the brackets (<e>[]</e>) is the handle or ID for that |
| 217 | particular VM. You use the handle or the number to <c>java-config |
219 | particular VM. You use the handle or the number to <c>java-config |
| 218 | --set-system-vm</c>. Here is an example of how to set the system VM. |
220 | --set-system-vm</c>. Here is an example of how to set the system VM. |
| 219 | </p> |
221 | </p> |
| 220 | |
222 | |
| 221 | <pre caption="Setting the System VM"> |
223 | <pre caption="Setting the System VM"> |
| 222 | <comment>(By handle (preferred))</comment> |
224 | <comment>(By handle (preferred))</comment> |
| 223 | # <i>java-config --set-system-vm blackdown-jdk-1.4</i> |
225 | # <i>java-config --set-system-vm sun-jdk-1.6</i> |
|
|
226 | Now using sun-jdk-1.6 as your generation-2 system JVM |
| 224 | <comment>(By number)</comment> |
227 | <comment>(By number)</comment> |
| 225 | # <i>java-config --set-system-vm 2</i> |
228 | # <i>java-config --set-system-vm 3</i> |
|
|
229 | Now using sun-jdk-1.6 as your generation-2 system JVM |
| 226 | </pre> |
230 | </pre> |
| 227 | |
231 | |
| 228 | <p> |
232 | <p> |
| 229 | As a regular user, you can use <c>java-config --set-user-vm</c>. |
233 | As a regular user, you can use <c>java-config --set-user-vm</c>. |
| 230 | </p> |
234 | </p> |
| … | |
… | |
| 234 | VM take place. |
238 | VM take place. |
| 235 | </note> |
239 | </note> |
| 236 | |
240 | |
| 237 | </body> |
241 | </body> |
| 238 | </section> |
242 | </section> |
|
|
243 | <section id="build-only"> |
|
|
244 | <title>Build Only VM</title> |
|
|
245 | <body> |
|
|
246 | |
|
|
247 | <p> |
|
|
248 | Some virtual machines are flagged as build-only due to being EOL and/or |
|
|
249 | containing security vulnerabilities. These virtual machines will not |
|
|
250 | automatically be used by Gentoo for the running of applications using Gentoo |
|
|
251 | launchers but will still be available for use by Gentoo's build environment as |
|
|
252 | some packages may require them for building. The setting of these virtual |
|
|
253 | machines as either your system or user VM is strongly discouraged as these VMs |
|
|
254 | will then be used when running the <path>/usr/bin/{java,javac,..}</path> |
|
|
255 | executables and will also be used by any packages not using Gentoo's launcher |
|
|
256 | scripts. |
|
|
257 | </p> |
|
|
258 | |
|
|
259 | </body> |
|
|
260 | </section> |
| 239 | <section id="preferred-vm"> |
261 | <section id="preferred-vm"> |
| 240 | <title>Preferred VM</title> |
262 | <title>Preferred VM</title> |
| 241 | <body> |
263 | <body> |
| 242 | |
264 | |
| 243 | <p> |
265 | <p> |
| … | |
… | |
| 247 | <p> |
269 | <p> |
| 248 | Because of the wide variety of available VMs, we do not have the resources to |
270 | Because of the wide variety of available VMs, we do not have the resources to |
| 249 | test and verify every package works on all of them. So to ensure that every |
271 | test and verify every package works on all of them. So to ensure that every |
| 250 | packages merges smoothly, we have defined a list of <e>default/supported |
272 | packages merges smoothly, we have defined a list of <e>default/supported |
| 251 | VMs</e> per arch. You can find them in |
273 | VMs</e> per arch. You can find them in |
| 252 | <path>/usr/share/java-config/config/jdk-defaults.conf</path>. When you are |
274 | <path>/usr/share/java-config-2/config/jdk-defaults.conf</path>. When you are |
| 253 | merging a Java package, and it detects one of the VM in that file is installed, |
275 | merging a Java package, and it detects one of the VM in that file is installed, |
| 254 | it will automatically use that VM, instead of the system-vm. |
276 | it will automatically use that VM, instead of the system-vm. |
| 255 | </p> |
277 | </p> |
| 256 | |
278 | |
| 257 | <p> |
279 | <p> |
| … | |
… | |
| 276 | *=sun-jdk-1.5 |
298 | *=sun-jdk-1.5 |
| 277 | </pre> |
299 | </pre> |
| 278 | |
300 | |
| 279 | <pre caption="Example /etc/java-config-2/build/jdk.conf"> |
301 | <pre caption="Example /etc/java-config-2/build/jdk.conf"> |
| 280 | <comment># For 1.3 I prefer sun-jdk 1.4 but when it is not available, use ibm-jdk-bin, |
302 | <comment># For 1.3 I prefer sun-jdk 1.4 but when it is not available, use ibm-jdk-bin, |
| 281 | # For 1.4, use blackdown-jdk, and for 1.5, use sun-jdk </comment> |
303 | # For 1.5, use sun-jdk </comment> |
| 282 | 1.3=sun-jdk-1.4 ibm-jdk-bin |
304 | 1.3=sun-jdk-1.4 ibm-jdk-bin |
| 283 | 1.4=blackdown-jdk |
|
|
| 284 | 1.5=sun-jdk |
305 | 1.5=sun-jdk |
| 285 | </pre> |
306 | </pre> |
| 286 | |
307 | |
| 287 | <warn> |
308 | <warn> |
| 288 | You do not have to edit this file. If you change these options to use a |
309 | You do not <e>have</e> to edit this file. If you change these options to use a |
| 289 | unsupported VM, things could possibly break. Bugs reported with a unsupported |
310 | unsupported VM, things could possibly break. Bugs reported with a unsupported VM |
| 290 | VM will a lower priority if they aren't present with supported VMs. |
311 | won't be prioritized as much as bugs present within supported VMs. |
| 291 | </warn> |
312 | </warn> |
| 292 | |
313 | |
| 293 | </body> |
314 | </body> |
| 294 | </section> |
315 | </section> |
| 295 | </chapter> |
316 | </chapter> |
| … | |
… | |
| 310 | <pre caption="/etc/java-config-2/build/compilers.conf"> |
331 | <pre caption="/etc/java-config-2/build/compilers.conf"> |
| 311 | # If the ebuild supports it |
332 | # If the ebuild supports it |
| 312 | # it will check the COMPILERS var front to back and |
333 | # it will check the COMPILERS var front to back and |
| 313 | # use the first compiler that is installed |
334 | # use the first compiler that is installed |
| 314 | |
335 | |
| 315 | COMPILERS="ecj-3.1 jikes javac" |
336 | COMPILERS="ecj-X.Y jikes javac" |
| 316 | </pre> |
337 | </pre> |
| 317 | |
338 | |
| 318 | <p> |
339 | <p> |
| 319 | Some compilers don't support all possible -target and -source arguments. |
340 | Some compilers don't support all possible -target and -source arguments. |
| 320 | Therefore, each compiler in the list is checked to see if it can support the |
341 | Therefore, each compiler in the list is checked to see if it can support the |
| … | |
… | |
| 352 | 1.5 syntax yet. |
373 | 1.5 syntax yet. |
| 353 | </ti> |
374 | </ti> |
| 354 | </tr> |
375 | </tr> |
| 355 | <tr> |
376 | <tr> |
| 356 | <ti>Eclipse Compiler for Java</ti> |
377 | <ti>Eclipse Compiler for Java</ti> |
| 357 | <ti>ecj-3.1</ti> |
378 | <ti>ecj</ti> |
| 358 | <ti>=dev-java/eclipse-ecj-3.1*</ti> |
379 | <ti>dev-java/eclipse-ecj</ti> |
| 359 | <ti> |
380 | <ti> |
| 360 | ECJ is the compiler used by the Eclipse software development kit. It is |
381 | ECJ is the compiler used by the Eclipse software development kit. It is |
| 361 | very full featured, and is pretty fast. It does support Java 1.5 syntax. |
382 | very full featured, and is pretty fast. It does support Java 1.5 syntax. |
| 362 | </ti> |
383 | </ti> |
| 363 | </tr> |
384 | </tr> |
| … | |
… | |
| 372 | <section> |
393 | <section> |
| 373 | <body> |
394 | <body> |
| 374 | |
395 | |
| 375 | <warn> |
396 | <warn> |
| 376 | The options explained in this section should be considered deprecated and will |
397 | The options explained in this section should be considered deprecated and will |
| 377 | be most likely be removed in the future. We strongly recommend against using |
398 | most likely be removed in the future. We strongly recommend against using |
| 378 | these, because your Java projects or application should ideally manage their |
399 | these, because your Java projects or application should ideally manage their |
| 379 | own classpaths. If you choose to specify a default CLASSPATH, some applications |
400 | own classpaths. If you choose to specify a default CLASSPATH, some applications |
| 380 | may behave unexpectedly, because classes they weren't expecting would be on the |
401 | may behave unexpectedly, because classes they weren't expecting would be on the |
| 381 | classpath. |
402 | classpath. |
| 382 | </warn> |
403 | </warn> |
| … | |
… | |
| 414 | The current directory (<path>.</path>) will not be part of the system |
435 | The current directory (<path>.</path>) will not be part of the system |
| 415 | classpath, as that should be added in your system's login profile. |
436 | classpath, as that should be added in your system's login profile. |
| 416 | </note> |
437 | </note> |
| 417 | |
438 | |
| 418 | <p> |
439 | <p> |
| 419 | You will have to update your environment by relogging in or sourcing |
440 | You will have to update your environment by logging out, then in again or |
| 420 | <path>/etc/profile</path>. |
441 | sourcing <path>/etc/profile</path>. |
| 421 | </p> |
442 | </p> |
| 422 | |
443 | |
| 423 | <p> |
444 | <p> |
| 424 | For users, <c>java-config --set-user-classpath</c> will create |
445 | For users, <c>java-config --set-user-classpath</c> will create |
| 425 | <path>~/.gentoo/java-env-classpath</path>, which you should then source from |
446 | <path>~/.gentoo/java-env-classpath</path>, which you should then source from |
| 426 | your shell's profile. |
447 | your shell's profile. |
| 427 | </p> |
448 | </p> |
| 428 | |
449 | |
| 429 | <pre caption="Sourcing user specific classpath"> |
450 | <pre caption="Sourcing user specific classpath"> |
| 430 | <i>if [[ -f "${HOME}/.gentoo/java-env-classpath" ]]; then |
451 | <i>if [[ -f "${HOME}/.gentoo/java-env-classpath" ]]; then |
| 431 | source ${HOME}/.gentoo/java-env-classpath |
452 | source ${HOME}/.gentoo/java-env-classpath |
| 432 | fi</i> |
453 | fi</i> |
| 433 | </pre> |
454 | </pre> |
| 434 | |
455 | |
| 435 | <p> |
456 | <p> |
| 436 | If you really want a system wide or user default classpath you can add |
457 | If you really want a system wide or user default classpath you can add |
| 437 | something like like the following to your shell's profile. But we would advise |
458 | something like the following to your shell's profile. But we would advise |
| 438 | against it. |
459 | against it. |
| 439 | </p> |
460 | </p> |
| 440 | |
461 | |
| 441 | <pre caption="Setting classpath"> |
462 | <pre caption="Setting classpath"> |
| 442 | # <i>export CLASSPATH="${CLASSPATH}:$(java-config --classpath log4j,xerces-2)"</i> |
463 | # <i>export CLASSPATH="${CLASSPATH}:$(java-config --classpath log4j,xerces-2)"</i> |
|
|
464 | </pre> |
|
|
465 | |
|
|
466 | </body> |
|
|
467 | </section> |
|
|
468 | </chapter> |
|
|
469 | |
|
|
470 | <chapter> |
|
|
471 | <title>Java Browser Plugins</title> |
|
|
472 | <section> |
|
|
473 | <title>Installing a plugin</title> |
|
|
474 | <body> |
|
|
475 | |
|
|
476 | <p> |
|
|
477 | You can install a Java plugin for your web browser by emerging a Java VM with |
|
|
478 | the <c>nsplugin</c> USE flag set. |
|
|
479 | </p> |
|
|
480 | |
|
|
481 | <note> |
|
|
482 | <c>nsplugin</c> is not available for all architectures. Check for available |
|
|
483 | plugins on your arch before trying to install a VM by running <c>emerge -pv |
|
|
484 | <java-vm></c>. |
|
|
485 | </note> |
|
|
486 | |
|
|
487 | <p> |
|
|
488 | Portage will allow you to install multiple versions of Java plugins, though |
|
|
489 | only one will be used by your browser. You can check the list of available |
|
|
490 | plugins by running: |
|
|
491 | </p> |
|
|
492 | |
|
|
493 | <pre caption="Viewing available plugins"> |
|
|
494 | # <i>eselect java-nsplugin list</i> |
|
|
495 | [1] sun-jre-bin-1.6 |
|
|
496 | [2] icedtea6-bin |
|
|
497 | </pre> |
|
|
498 | |
|
|
499 | <p> |
|
|
500 | In this example, <c>sun-jre-bin</c> is selected for the browser plugin. |
|
|
501 | </p> |
|
|
502 | |
|
|
503 | <pre caption="Selecting a plugin"> |
|
|
504 | # <i>eselect java-nsplugin set sun-jre-bin-1.6</i> |
|
|
505 | </pre> |
|
|
506 | |
|
|
507 | <p> |
|
|
508 | Verify that the correct plugin was selected: |
|
|
509 | </p> |
|
|
510 | |
|
|
511 | <pre caption="Verifying the correct plugin"> |
|
|
512 | # <i>eselect java-nsplugin list</i> |
|
|
513 | [1] sun-jre-bin-1.6 current |
|
|
514 | [2] icedtea6-bin |
|
|
515 | </pre> |
|
|
516 | |
|
|
517 | <p> |
|
|
518 | Java.com also provides a link to <uri |
|
|
519 | link="http://java.com/en/download/installed.jsp">verify your installed |
|
|
520 | plugin</uri>. Additionally, if you are using a Mozilla-based browser, you can |
|
|
521 | verify your Java plugin by typing <c>about:plugins</c> into the address bar. |
|
|
522 | </p> |
|
|
523 | |
|
|
524 | </body> |
|
|
525 | </section> |
|
|
526 | <section> |
|
|
527 | <title>Plugins on multilib systems</title> |
|
|
528 | <body> |
|
|
529 | |
|
|
530 | <p> |
|
|
531 | If you are running a mixed 64-bit and 32-bit multilib system (for example, on |
|
|
532 | AMD64), you can use 64-bit and 32-bit Java plugins. Unless you have a pressing |
|
|
533 | need to run 32-bit Java applications, we recommend using native 64-bit plugins |
|
|
534 | on 64-bit web browsers. |
|
|
535 | </p> |
|
|
536 | |
|
|
537 | <p> |
|
|
538 | There are several native 64-bit browser plugins available. The default JDK/JRE |
|
|
539 | pair, <c>sun-jdk</c> and <c>sun-jre-bin</c>, both include browser plugins. Just |
|
|
540 | emerge one of them with the <c>nsplugin</c> USE flag enabled. |
|
|
541 | </p> |
|
|
542 | |
|
|
543 | <pre caption="Installing a 64-bit plugin"> |
|
|
544 | # <i>echo "dev-java/sun-jre-bin nsplugin" >> /etc/portage/package.use</i> |
|
|
545 | # <i>emerge sun-jre-bin</i> |
|
|
546 | </pre> |
|
|
547 | |
|
|
548 | <p> |
|
|
549 | To use a 32-bit plugin on a 32-bit browser, you will need to emerge |
|
|
550 | <c>emul-linux-x86-java</c> with the <c>nsplugin</c> USE flag enabled. |
|
|
551 | </p> |
|
|
552 | |
|
|
553 | <pre caption="Installing a 32-bit plugin"> |
|
|
554 | # <i>echo "app-emulation/emul-linux-x86-java nsplugin" >> /etc/portage/package.use</i> |
|
|
555 | # <i>emerge emul-linux-x86-java</i> |
|
|
556 | </pre> |
|
|
557 | |
|
|
558 | <p> |
|
|
559 | Next, check which plugins are available: |
|
|
560 | </p> |
|
|
561 | |
|
|
562 | <pre caption="Viewing available plugins"> |
|
|
563 | # <i>eselect java-nsplugin list</i> |
|
|
564 | Available 32-bit Java browser plugins |
|
|
565 | [1] emul-linux-x86-java-1.5 |
|
|
566 | [2] emul-linux-x86-java-1.6 |
|
|
567 | Available 64-bit Java browser plugins |
|
|
568 | [1] icedtea6-bin |
|
|
569 | [2] sun-jre-bin-1.6 |
|
|
570 | </pre> |
|
|
571 | |
|
|
572 | <p> |
|
|
573 | Now select the right plugin for your browsers: |
|
|
574 | </p> |
|
|
575 | |
|
|
576 | <pre caption="Selecting plugins"> |
|
|
577 | <comment>(Choose the plugins for 32-bit and 64-bit browsers)</comment> |
|
|
578 | # <i>eselect java-nsplugin set 32bit emul-linux-x86-java-1.6</i> |
|
|
579 | # <i>eselect java-nsplugin set 64bit sun-jre-bin-1.6</i> |
|
|
580 | </pre> |
|
|
581 | |
|
|
582 | <p> |
|
|
583 | Verify the correct plugin was selected: |
|
|
584 | </p> |
|
|
585 | |
|
|
586 | <pre caption="Verifying the correct plugin"> |
|
|
587 | # <i>eselect java-nsplugin list</i> |
|
|
588 | Available 32-bit Java browser plugins |
|
|
589 | [1] emul-linux-x86-java-1.5 |
|
|
590 | [2] emul-linux-x86-java-1.6 current |
|
|
591 | Available 64-bit Java browser plugins |
|
|
592 | [1] icedtea6-bin |
|
|
593 | [2] sun-jre-bin-1.6 current |
| 443 | </pre> |
594 | </pre> |
| 444 | |
595 | |
| 445 | </body> |
596 | </body> |
| 446 | </section> |
597 | </section> |
| 447 | </chapter> |
598 | </chapter> |
| … | |
… | |
| 466 | |
617 | |
| 467 | <ul> |
618 | <ul> |
| 468 | <li>The <b>java</b> flag adds support for Java in a variety of programs</li> |
619 | <li>The <b>java</b> flag adds support for Java in a variety of programs</li> |
| 469 | <li> |
620 | <li> |
| 470 | The <b>nsplugin</b> flag adds support for Mozilla-like browsers (including |
621 | The <b>nsplugin</b> flag adds support for Mozilla-like browsers (including |
| 471 | Firefox).You will need this for viewing Java applets in your Mozilla-like |
622 | Firefox). You will need this for viewing Java applets in your Mozilla-like |
| 472 | browser. |
623 | browser. |
| 473 | </li> |
624 | </li> |
| 474 | <li> |
625 | <li> |
| 475 | The <b>doc</b> flag will typically install API documentation, as generated |
626 | The <b>source</b> flag installs a zip of the source code of a package. |
| 476 | by javadoc. |
627 | This is traditionally used for IDEs to 'attach' source to the libraries you |
| 477 | </li> |
628 | are using. |
| 478 | <li> |
629 | </li> |
| 479 | The <b>source</b> flag will install a zip of the package's source code. |
630 | <li>The <b>jce</b> flag adds support for the Java Cryptography Engine</li> |
| 480 | This is typically used to provide your IDE with the source code for the |
631 | <li> |
| 481 | package. |
632 | For Java packages, the <b>doc</b> flag will build API documentation using |
|
|
633 | javadoc. |
| 482 | </li> |
634 | </li> |
| 483 | </ul> |
635 | </ul> |
| 484 | |
636 | |
| 485 | </body> |
637 | </body> |
| 486 | </section> |
638 | </section> |
| … | |
… | |
| 515 | link="http://news.gmane.org/gmane.linux.gentoo.user">gentoo-user</uri>, and |
667 | link="http://news.gmane.org/gmane.linux.gentoo.user">gentoo-user</uri>, and |
| 516 | <uri |
668 | <uri |
| 517 | link="http://news.gmane.org/gmane.linux.gentoo.devel">gentoo-dev</uri> |
669 | link="http://news.gmane.org/gmane.linux.gentoo.devel">gentoo-dev</uri> |
| 518 | mailing list archives |
670 | mailing list archives |
| 519 | </li> |
671 | </li> |
| 520 | <li>#gentoo and #gentoo-java on irc.freenode.net</li> |
672 | <li> |
|
|
673 | <uri link="irc://irc.gentoo.org/gentoo">#gentoo</uri> and <uri |
|
|
674 | link="irc://irc.gentoo.org/gentoo-java">#gentoo-java</uri> on IRC |
|
|
675 | </li> |
| 521 | <li> |
676 | <li> |
| 522 | <uri |
677 | <uri |
| 523 | link="http://en.wikipedia.org/wiki/Java_programming_language">Wikipedia's |
678 | link="http://en.wikipedia.org/wiki/Java_programming_language">Wikipedia's |
| 524 | entry for Java</uri> |
679 | entry for Java</uri> |
| 525 | </li> |
680 | </li> |
|
|
681 | <li> |
|
|
682 | If you have suggestions or questions regarding this document, please email |
|
|
683 | the Gentoo Java team: <mail>java@gentoo.org</mail> |
|
|
684 | </li> |
| 526 | </ul> |
685 | </ul> |
| 527 | |
686 | |
| 528 | </body> |
687 | </body> |
| 529 | </section> |
688 | </section> |
| 530 | </chapter> |
689 | </chapter> |