/[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.14 - (hide annotations) (download) (as text)
Sun Mar 6 12:08:19 2005 UTC (9 years, 6 months ago) by swift
Branch: MAIN
Changes since 1.13: +5 -4 lines
File MIME type: application/xml
#84282 - Fix ambiguosity (sp?), tx to aaby

1 neysx 1.11 <?xml version="1.0" encoding="UTF-8"?>
2 swift 1.14 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/java.xml,v 1.13 2005/02/07 19:27:44 swift Exp $ -->
3 swift 1.8 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
4 zhen 1.4
5 neysx 1.11 <guide link="/doc/en/java.xml">
6     <title>Gentoo Java Guide</title>
7    
8     <author title="Author and Editor">
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>
13     </author>
14 swift 1.13 <author title="Editor">
15     <mail link="marcelogoes@gmail.com">Marcelo Góes</mail>
16     </author>
17 neysx 1.11
18     <abstract>
19 swift 1.13 This guide will introduce users and developers to Java and explain how to use
20     Java with Gentoo Linux.
21 neysx 1.11 </abstract>
22    
23     <license/>
24    
25 swift 1.14 <version>0.1.6</version>
26     <date>2005-03-06</date>
27 neysx 1.11
28     <chapter>
29 swift 1.13 <title>What is Java?</title>
30 neysx 1.11 <section>
31     <title>Overview</title>
32     <body>
33    
34     <p>
35 swift 1.13 Java is a programming language developed by engineers of Sun Microsystems.
36     The language is object-oriented and designed to run on multiple platforms
37     without the need of recompiling code for each platform. Although Java can
38     be compiled as a native program, much of Java's popularity can be attributed
39     to its portability, along with other features such as garbage collection.
40     The ability to compile once and run in various platforms is achieved through
41     the use of just-in-time compilers (JIT), which compile Java bytecodes into
42     native code when a given program is run.
43     </p>
44    
45     <p>
46     In order to run Java bytecodes, one needs to have a JRE (Java Runtime Environment)
47     installed. A JRE provides core libraries, a platform dependent Java Virtual Machine,
48     plug-ins for browsers, among other things. A JDK (Java Development Kit) adds
49     programming tools, such as a bytecode compiler and a debugger.
50     </p>
51    
52     </body>
53     </section>
54     </chapter>
55    
56     <chapter>
57     <title>Installing a JRE/JDK</title>
58     <section>
59     <title>The choices</title>
60     <body>
61    
62     <p>
63     Gentoo provides numerous JREs and JDKs. Among the current alternatives, we have:
64     </p>
65    
66     <ul>
67     <li>blackdown-jre and blackdown-jdk, the Blackdown Java Kit</li>
68     <li>sun-jre-bin and sun-jdk, Sun's Java Kit </li>
69     <li>ibm-jre-bin and ibm-jdk-bin, the IBM Java Kit</li>
70     <li>compaq-jre and compaq-jdk, the Compaq Java Kit for Alpha/Linux/GNU</li>
71     <li>jrockit-jdk-bin, BEA WebLogic's J2SE Development Kit</li>
72     </ul>
73    
74     <p>
75     The default is the Blackdown JRE/JDK
76 swift 1.14 pair, as it is freely ("free as in beer") available without any registration
77     fuss.
78 neysx 1.11 </p>
79    
80     <p>
81 swift 1.13 Both the Sun JRE/JDK and the IBM JRE/JDK are generally faster, but getting them
82 neysx 1.11 is a bit more work, as you are required to read and accept their license before
83     downloading (IBM additionally requires you to register).
84     </p>
85    
86     <p>
87 swift 1.13 Our ebuilds for the Sun and IBM JRE/JDKs will notify you of where to go to
88 neysx 1.11 download them.
89     </p>
90    
91     </body>
92     </section>
93    
94     <section>
95 swift 1.13 <title>Installing the Sun/IBM JRE/JDKs</title>
96 neysx 1.11 <body>
97    
98     <p>
99 swift 1.13 If you run <c>emerge =sun-jdk-1.4.2.06</c> or <c>=ibm-jdk-bin-1.4.2</c>, you will
100 neysx 1.11 be notified that you are required to download the actual tarballs yourself. This
101 swift 1.13 has to do with license restrictions for the Sun JRE/JDK (online click-wrap
102     license) and registration issues with the IBM JRE/JDK.
103 neysx 1.11 </p>
104    
105     <note>
106 swift 1.13 ibm-jdk-bin is currently masked, you may have to unmask it to use it.
107 neysx 1.11 </note>
108    
109     <p>
110     You should download the indicated file(s) into
111     <path>/usr/portage/distfiles</path>. Once that is done, you can rerun the emerge
112 swift 1.13 command, then the JRE/JDK will be installed properly into <path>/opt</path>.
113 neysx 1.11 </p>
114    
115     </body>
116     </section>
117     </chapter>
118    
119     <chapter>
120 swift 1.13 <title>Configuring your JRE/JDK</title>
121 neysx 1.11 <section>
122     <title>Overview</title>
123     <body>
124    
125     <p>
126     Gentoo has the ability to have multiple JDKs and JREs installed without them
127     conflicting.
128     </p>
129    
130     <p>
131     Using the <c>java-config</c> tool, you can set the system-wide default if you
132     have root access. Users can also use <c>java-config</c> to set up their own
133     personal default, that is different from the system-wide default.
134     </p>
135    
136     </body>
137     </section>
138    
139     <section>
140 swift 1.13 <title>Setting a default JRE/JDK</title>
141 neysx 1.11 <body>
142    
143     <p>
144     Running the command <c>java-config --list-available-vms</c> will give you a list
145 swift 1.13 of all available JREs and JDKs on your system. Here is an example of output:
146 neysx 1.11 </p>
147    
148     <pre caption="Listing available VMs">
149 neysx 1.12 # <i>java-config --list-available-vms</i>
150 drobbins 1.1 [blackdown-jdk-1.3.1] Blackdown JDK 1.3.1 (/etc/env.d/java/20blackdown-jdk-1.3.1)
151     [blackdown-jre-1.3.1] Blackdown JRE 1.3.1 (/etc/env.d/java/20blackdown-jre-1.3.1)
152     [ibm-jdk-1.3.0] IBM JDK 1.3.0 (/etc/env.d/java/20ibm-jdk-1.3.0)
153     [ibm-jdk-1.3.1] IBM JDK 1.3.1 (/etc/env.d/java/20ibm-jdk-1.3.1)
154     [ibm-jre-1.3.1] IBM JRE 1.3.1 (/etc/env.d/java/20ibm-jre-1.3.1)
155     [sun-jdk-1.4.0] Sun JDK 1.4.0 (/etc/env.d/java/20sun-jdk-1.4.0)
156 neysx 1.11 </pre>
157    
158     <p>
159     The name in the brackets <path>"[]"</path> is the handle or ID for that
160 swift 1.13 particular VM. You use pass that ID to <c>java-config --set-system-vm</c>. Here is
161     an example of how to set the system VM.
162 neysx 1.11 </p>
163 zhen 1.4
164 neysx 1.11 <pre caption="Setting the System VM">
165 neysx 1.12 # <i>java-config --set-system-vm=ibm-jdk-1.3.1</i>
166 drobbins 1.1 Now using IBM JDK 1.3.1 (/etc/env.d/java/20ibm-jdk-1.3.1)
167 neysx 1.11 </pre>
168 drobbins 1.1
169 neysx 1.11 <note>
170     You will have to be root to run --set-system-vm.
171     </note>
172    
173     <p>
174     Once you have issued <c>java-config --set-system-vm</c> with a particular VM ID,
175 swift 1.13 you will need to regenerate your /etc/profile.env. You can do it like this:
176 neysx 1.11 </p>
177 drobbins 1.1
178 neysx 1.11 <pre caption="Regenerating /etc/profile.env" >
179 neysx 1.12 # <i>env-update</i>
180 neysx 1.11 </pre>
181 drobbins 1.1
182 neysx 1.11 <p>
183     After this, you will either want to relogin, or resource
184     <path>/etc/profile</path> into your environment.
185     </p>
186    
187     <p>
188     As a regular user, you can use <c>java-config --set-user-vm</c>, which will
189 swift 1.13 create <path>~/.gentoo/java-env</path> with all required env vars. You would
190 neysx 1.11 normally source this from your shell's startup script
191 swift 1.13 (generally <path>~/.bashrc</path>).
192 neysx 1.11 </p>
193    
194     </body>
195     </section>
196    
197     <section>
198     <title>Setting a default CLASSPATH</title>
199     <body>
200    
201     <p>
202     <c>java-config</c> can also be used to set a system-wide default CLASSPATH, and
203     of course a user-specific default CLASSPATH.
204     </p>
205    
206     <p>
207     First you want to list available java libraries that might be interesting to put
208 swift 1.13 in your CLASSPATH. Here is an example of output:
209 neysx 1.11 </p>
210    
211     <pre caption="Listing classes">
212 neysx 1.12 # <i>java-config --list-available-packages</i>
213 swift 1.13 [bsh] BeanShell is a small, free, embeddable, Java
214     source interpreter with object scripting language
215     features. (/usr/share/bsh/package.env)
216     [oro] A set of text-processing Java classes that
217     provide Perl5 compatible regular expressions, AWK-like
218     regular expressions, glob expressions, and utility
219     classes for performing substitutions, splits, filtering
220     filenames, etc. (/usr/share/oro/package.env)
221     [bcel] The Byte Code Engineering Library: analyze, create,
222     manipulate Java class files (/usr/share/bcel/package.env)
223     [jsch] JSch is a pure Java implementation of SSH2.
224     (/usr/share/jsch/package.env)
225     ...
226 neysx 1.11 </pre>
227 zhen 1.4
228 neysx 1.11 <p>
229     Again, the name in brackets <path>"[]"</path> are the IDs that you have to pass
230 swift 1.13 to <c>java-config --set-system-classpath</c>. Here is an example:
231 neysx 1.11 </p>
232 drobbins 1.1
233 neysx 1.11 <pre caption="Setting classpaths">
234 neysx 1.12 # <i>java-config --set-system-classpath=log4j,java-gtk,java-gnome</i>
235 neysx 1.11 </pre>
236    
237     <note>
238     The current directory (.) will not be part of the system classpath, as that
239     should be added in root's login profile.
240     </note>
241    
242     <p>
243     Again, you will want to run <c>env-update</c> to update your system's
244     environment, and you might also want to relogin or resource the
245     <path>/etc/profile</path>.
246     </p>
247    
248     <p>
249     For users, <c>java-config --set-user-classpath</c> will create
250 swift 1.13 <path>~/.gentoo/java-env-classpath</path>, which is automatically included
251     by <path>~/.gentoo/java-env</path>.
252     </p>
253    
254     </body>
255     </section>
256     </chapter>
257    
258     <chapter>
259     <title>USE flags for use with Java</title>
260     <section>
261     <title>Setting USE flags</title>
262     <body>
263    
264     <p>
265     For more information regarding USE flags, refer to the
266     <uri link="/doc/en/handbook/handbook-x86.xml?part=2&amp;chap=2">USE flags</uri>
267     chapter from the Gentoo Handbook.
268 neysx 1.11 </p>
269    
270     </body>
271     </section>
272 swift 1.13 <section>
273     <title>The flags</title>
274     <body>
275    
276     <ul>
277     <li>The <b>java</b> flag adds support for Java in a variety of programs.</li>
278     <li>The <b>mozilla</b> flag adds support for Mozilla-like browsers (including Firefox)
279     if you are using blackdown's Java kit. You will need this for viewing Java applets
280     in your Mozilla-like browser.</li>
281     </ul>
282    
283     </body>
284     </section>
285 neysx 1.11 </chapter>
286    
287     <chapter>
288     <title>Additional resources</title>
289     <section>
290     <title>Off-line resources</title>
291     <body>
292    
293     <ul>
294     <li>java-config man page</li>
295     <li><c>java-config --help</c></li>
296     <li>The <path>/usr/bin/java-config</path> script itself</li>
297     </ul>
298    
299     </body>
300     </section>
301    
302     <section>
303     <title>Online resources</title>
304     <body>
305     <ul>
306     <li>The <uri link="http://news.gmane.org/gmane.linux.gentoo.devel"
307     >gentoo-dev</uri>, <uri link="http://news.gmane.org/gmane.linux.gentoo.user"
308     >gentoo-user </uri> mailing list archives</li>
309 neysx 1.12 <li>#gentoo and #gentoo-java on irc.freenode.net</li>
310 swift 1.13 <li><uri link="http://en.wikipedia.org/wiki/Java_programming_language">Wikipedia's entry for Java</uri></li>
311 neysx 1.11 </ul>
312    
313     </body>
314     </section>
315     </chapter>
316 neysx 1.12 </guide>

  ViewVC Help
Powered by ViewVC 1.1.20