1 |
38 |
julius |
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14
|
2 |
|
|
.\"
|
3 |
|
|
.\" Standard preamble:
|
4 |
|
|
.\" ========================================================================
|
5 |
|
|
.de Sh \" Subsection heading
|
6 |
|
|
.br
|
7 |
|
|
.if t .Sp
|
8 |
|
|
.ne 5
|
9 |
|
|
.PP
|
10 |
|
|
\fB\\$1\fR
|
11 |
|
|
.PP
|
12 |
|
|
..
|
13 |
|
|
.de Sp \" Vertical space (when we can't use .PP)
|
14 |
|
|
.if t .sp .5v
|
15 |
|
|
.if n .sp
|
16 |
|
|
..
|
17 |
|
|
.de Vb \" Begin verbatim text
|
18 |
|
|
.ft CW
|
19 |
|
|
.nf
|
20 |
|
|
.ne \\$1
|
21 |
|
|
..
|
22 |
|
|
.de Ve \" End verbatim text
|
23 |
|
|
.ft R
|
24 |
|
|
.fi
|
25 |
|
|
..
|
26 |
|
|
.\" Set up some character translations and predefined strings. \*(-- will
|
27 |
|
|
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
|
28 |
|
|
.\" double quote, and \*(R" will give a right double quote. | will give a
|
29 |
|
|
.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
|
30 |
|
|
.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
|
31 |
|
|
.\" expand to `' in nroff, nothing in troff, for use with C<>.
|
32 |
|
|
.tr \(*W-|\(bv\*(Tr
|
33 |
|
|
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
|
34 |
|
|
.ie n \{\
|
35 |
|
|
. ds -- \(*W-
|
36 |
|
|
. ds PI pi
|
37 |
|
|
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
|
38 |
|
|
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
|
39 |
|
|
. ds L" ""
|
40 |
|
|
. ds R" ""
|
41 |
|
|
. ds C` ""
|
42 |
|
|
. ds C' ""
|
43 |
|
|
'br\}
|
44 |
|
|
.el\{\
|
45 |
|
|
. ds -- \|\(em\|
|
46 |
|
|
. ds PI \(*p
|
47 |
|
|
. ds L" ``
|
48 |
|
|
. ds R" ''
|
49 |
|
|
'br\}
|
50 |
|
|
.\"
|
51 |
|
|
.\" If the F register is turned on, we'll generate index entries on stderr for
|
52 |
|
|
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
|
53 |
|
|
.\" entries marked with X<> in POD. Of course, you'll have to process the
|
54 |
|
|
.\" output yourself in some meaningful fashion.
|
55 |
|
|
.if \nF \{\
|
56 |
|
|
. de IX
|
57 |
|
|
. tm Index:\\$1\t\\n%\t"\\$2"
|
58 |
|
|
..
|
59 |
|
|
. nr % 0
|
60 |
|
|
. rr F
|
61 |
|
|
.\}
|
62 |
|
|
.\"
|
63 |
|
|
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
|
64 |
|
|
.\" way too many mistakes in technical documents.
|
65 |
|
|
.hy 0
|
66 |
|
|
.if n .na
|
67 |
|
|
.\"
|
68 |
|
|
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
|
69 |
|
|
.\" Fear. Run. Save yourself. No user-serviceable parts.
|
70 |
|
|
. \" fudge factors for nroff and troff
|
71 |
|
|
.if n \{\
|
72 |
|
|
. ds #H 0
|
73 |
|
|
. ds #V .8m
|
74 |
|
|
. ds #F .3m
|
75 |
|
|
. ds #[ \f1
|
76 |
|
|
. ds #] \fP
|
77 |
|
|
.\}
|
78 |
|
|
.if t \{\
|
79 |
|
|
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
|
80 |
|
|
. ds #V .6m
|
81 |
|
|
. ds #F 0
|
82 |
|
|
. ds #[ \&
|
83 |
|
|
. ds #] \&
|
84 |
|
|
.\}
|
85 |
|
|
. \" simple accents for nroff and troff
|
86 |
|
|
.if n \{\
|
87 |
|
|
. ds ' \&
|
88 |
|
|
. ds ` \&
|
89 |
|
|
. ds ^ \&
|
90 |
|
|
. ds , \&
|
91 |
|
|
. ds ~ ~
|
92 |
|
|
. ds /
|
93 |
|
|
.\}
|
94 |
|
|
.if t \{\
|
95 |
|
|
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
|
96 |
|
|
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
|
97 |
|
|
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
|
98 |
|
|
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
|
99 |
|
|
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
|
100 |
|
|
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
|
101 |
|
|
.\}
|
102 |
|
|
. \" troff and (daisy-wheel) nroff accents
|
103 |
|
|
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
|
104 |
|
|
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
|
105 |
|
|
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
|
106 |
|
|
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
|
107 |
|
|
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
|
108 |
|
|
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
|
109 |
|
|
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
|
110 |
|
|
.ds ae a\h'-(\w'a'u*4/10)'e
|
111 |
|
|
.ds Ae A\h'-(\w'A'u*4/10)'E
|
112 |
|
|
. \" corrections for vroff
|
113 |
|
|
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
|
114 |
|
|
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
|
115 |
|
|
. \" for low resolution devices (crt and lpr)
|
116 |
|
|
.if \n(.H>23 .if \n(.V>19 \
|
117 |
|
|
\{\
|
118 |
|
|
. ds : e
|
119 |
|
|
. ds 8 ss
|
120 |
|
|
. ds o a
|
121 |
|
|
. ds d- d\h'-1'\(ga
|
122 |
|
|
. ds D- D\h'-1'\(hy
|
123 |
|
|
. ds th \o'bp'
|
124 |
|
|
. ds Th \o'LP'
|
125 |
|
|
. ds ae ae
|
126 |
|
|
. ds Ae AE
|
127 |
|
|
.\}
|
128 |
|
|
.rm #[ #] #H #V #F C
|
129 |
|
|
.\" ========================================================================
|
130 |
|
|
.\"
|
131 |
|
|
.IX Title "GCJ 1"
|
132 |
|
|
.TH GCJ 1 "2007-10-07" "gcc-4.2.2" "GNU"
|
133 |
|
|
.SH "NAME"
|
134 |
|
|
gcj \- Ahead\-of\-time compiler for the Java language
|
135 |
|
|
.SH "SYNOPSIS"
|
136 |
|
|
.IX Header "SYNOPSIS"
|
137 |
|
|
gcj [\fB\-I\fR\fIdir\fR...] [\fB\-d\fR \fIdir\fR...]
|
138 |
|
|
[\fB\-\-CLASSPATH\fR=\fIpath\fR] [\fB\-\-classpath\fR=\fIpath\fR]
|
139 |
|
|
[\fB\-f\fR\fIoption\fR...] [\fB\-\-encoding\fR=\fIname\fR]
|
140 |
|
|
[\fB\-\-main\fR=\fIclassname\fR] [\fB\-D\fR\fIname\fR[=\fIvalue\fR]...]
|
141 |
|
|
[\fB\-C\fR] [\fB\-\-resource\fR \fIresource-name\fR] [\fB\-d\fR \fIdirectory\fR]
|
142 |
|
|
[\fB\-W\fR\fIwarn\fR...]
|
143 |
|
|
\fIsourcefile\fR...
|
144 |
|
|
.SH "DESCRIPTION"
|
145 |
|
|
.IX Header "DESCRIPTION"
|
146 |
|
|
As \fBgcj\fR is just another front end to \fBgcc\fR, it supports many
|
147 |
|
|
of the same options as gcc. This manual only documents the
|
148 |
|
|
options specific to \fBgcj\fR.
|
149 |
|
|
.SH "OPTIONS"
|
150 |
|
|
.IX Header "OPTIONS"
|
151 |
|
|
.Sh "Input and output files"
|
152 |
|
|
.IX Subsection "Input and output files"
|
153 |
|
|
A \fBgcj\fR command is like a \fBgcc\fR command, in that it
|
154 |
|
|
consists of a number of options and file names. The following kinds
|
155 |
|
|
of input file names are supported:
|
156 |
|
|
.IP "\fIfile\fR\fB.java\fR" 4
|
157 |
|
|
.IX Item "file.java"
|
158 |
|
|
Java source files.
|
159 |
|
|
.IP "\fIfile\fR\fB.class\fR" 4
|
160 |
|
|
.IX Item "file.class"
|
161 |
|
|
Java bytecode files.
|
162 |
|
|
.IP "\fIfile\fR\fB.zip\fR" 4
|
163 |
|
|
.IX Item "file.zip"
|
164 |
|
|
.PD 0
|
165 |
|
|
.IP "\fIfile\fR\fB.jar\fR" 4
|
166 |
|
|
.IX Item "file.jar"
|
167 |
|
|
.PD
|
168 |
|
|
An archive containing one or more \f(CW\*(C`.class\*(C'\fR files, all of
|
169 |
|
|
which are compiled. The archive may be compressed. Files in
|
170 |
|
|
an archive which don't end with \fB.class\fR are treated as
|
171 |
|
|
resource files; they are compiled into the resulting object file
|
172 |
|
|
as \fBcore:\fR URLs.
|
173 |
|
|
.IP "\fB@\fR\fIfile\fR" 4
|
174 |
|
|
.IX Item "@file"
|
175 |
|
|
A file containing a whitespace-separated list of input file names.
|
176 |
|
|
(Currently, these must all be \f(CW\*(C`.java\*(C'\fR source files, but that
|
177 |
|
|
may change.)
|
178 |
|
|
Each named file is compiled, just as if it had been on the command line.
|
179 |
|
|
.IP "\fIlibrary\fR\fB.a\fR" 4
|
180 |
|
|
.IX Item "library.a"
|
181 |
|
|
.PD 0
|
182 |
|
|
.IP "\fIlibrary\fR\fB.so\fR" 4
|
183 |
|
|
.IX Item "library.so"
|
184 |
|
|
.IP "\fB\-l\fR\fIlibname\fR" 4
|
185 |
|
|
.IX Item "-llibname"
|
186 |
|
|
.PD
|
187 |
|
|
Libraries to use when linking. See the \fBgcc\fR manual.
|
188 |
|
|
.PP
|
189 |
|
|
You can specify more than one input file on the \fBgcj\fR command line,
|
190 |
|
|
in which case they will all be compiled. If you specify a
|
191 |
|
|
\&\f(CW\*(C`\-o \f(CI\s-1FILENAME\s0\f(CW\*(C'\fR
|
192 |
|
|
option, all the input files will be compiled together, producing a
|
193 |
|
|
single output file, named \fI\s-1FILENAME\s0\fR.
|
194 |
|
|
This is allowed even when using \f(CW\*(C`\-S\*(C'\fR or \f(CW\*(C`\-c\*(C'\fR,
|
195 |
|
|
but not when using \f(CW\*(C`\-C\*(C'\fR or \f(CW\*(C`\-\-resource\*(C'\fR.
|
196 |
|
|
(This is an extension beyond the what plain \fBgcc\fR allows.)
|
197 |
|
|
(If more than one input file is specified, all must currently
|
198 |
|
|
be \f(CW\*(C`.java\*(C'\fR files, though we hope to fix this.)
|
199 |
|
|
.Sh "Input Options"
|
200 |
|
|
.IX Subsection "Input Options"
|
201 |
|
|
\&\fBgcj\fR has options to control where it looks to find files it needs.
|
202 |
|
|
For instance, \fBgcj\fR might need to load a class that is referenced
|
203 |
|
|
by the file it has been asked to compile. Like other compilers for the
|
204 |
|
|
Java language, \fBgcj\fR has a notion of a \fIclass path\fR. There are
|
205 |
|
|
several options and environment variables which can be used to
|
206 |
|
|
manipulate the class path. When \fBgcj\fR looks for a given class, it
|
207 |
|
|
searches the class path looking for matching \fI.class\fR or
|
208 |
|
|
\&\fI.java\fR file. \fBgcj\fR comes with a built-in class path which
|
209 |
|
|
points at the installed \fIlibgcj.jar\fR, a file which contains all the
|
210 |
|
|
standard classes.
|
211 |
|
|
.PP
|
212 |
|
|
In the below, a directory or path component can refer either to an
|
213 |
|
|
actual directory on the filesystem, or to a \fI.zip\fR or \fI.jar\fR
|
214 |
|
|
file, which \fBgcj\fR will search as if it is a directory.
|
215 |
|
|
.IP "\fB\-I\fR\fIdir\fR" 4
|
216 |
|
|
.IX Item "-Idir"
|
217 |
|
|
All directories specified by \f(CW\*(C`\-I\*(C'\fR are kept in order and prepended
|
218 |
|
|
to the class path constructed from all the other options. Unless
|
219 |
|
|
compatibility with tools like \f(CW\*(C`javac\*(C'\fR is important, we recommend
|
220 |
|
|
always using \f(CW\*(C`\-I\*(C'\fR instead of the other options for manipulating the
|
221 |
|
|
class path.
|
222 |
|
|
.IP "\fB\-\-classpath=\fR\fIpath\fR" 4
|
223 |
|
|
.IX Item "--classpath=path"
|
224 |
|
|
This sets the class path to \fIpath\fR, a colon-separated list of paths
|
225 |
|
|
(on Windows-based systems, a semicolon-separate list of paths).
|
226 |
|
|
This does not override the builtin (\*(L"boot\*(R") search path.
|
227 |
|
|
.IP "\fB\-\-CLASSPATH=\fR\fIpath\fR" 4
|
228 |
|
|
.IX Item "--CLASSPATH=path"
|
229 |
|
|
Deprecated synonym for \f(CW\*(C`\-\-classpath\*(C'\fR.
|
230 |
|
|
.IP "\fB\-\-bootclasspath=\fR\fIpath\fR" 4
|
231 |
|
|
.IX Item "--bootclasspath=path"
|
232 |
|
|
Where to find the standard builtin classes, such as \f(CW\*(C`java.lang.String\*(C'\fR.
|
233 |
|
|
.IP "\fB\-\-extdirs=\fR\fIpath\fR" 4
|
234 |
|
|
.IX Item "--extdirs=path"
|
235 |
|
|
For each directory in the \fIpath\fR, place the contents of that
|
236 |
|
|
directory at the end of the class path.
|
237 |
|
|
.IP "\fB\s-1CLASSPATH\s0\fR" 4
|
238 |
|
|
.IX Item "CLASSPATH"
|
239 |
|
|
This is an environment variable which holds a list of paths.
|
240 |
|
|
.PP
|
241 |
|
|
The final class path is constructed like so:
|
242 |
|
|
.IP "\(bu" 4
|
243 |
|
|
First come all directories specified via \f(CW\*(C`\-I\*(C'\fR.
|
244 |
|
|
.IP "\(bu" 4
|
245 |
|
|
If \fB\-\-classpath\fR is specified, its value is appended.
|
246 |
|
|
Otherwise, if the \f(CW\*(C`CLASSPATH\*(C'\fR environment variable is specified,
|
247 |
|
|
then its value is appended.
|
248 |
|
|
Otherwise, the current directory (\f(CW"."\fR) is appended.
|
249 |
|
|
.IP "\(bu" 4
|
250 |
|
|
If \f(CW\*(C`\-\-bootclasspath\*(C'\fR was specified, append its value.
|
251 |
|
|
Otherwise, append the built-in system directory, \fIlibgcj.jar\fR.
|
252 |
|
|
.IP "\(bu" 4
|
253 |
|
|
Finally, if \f(CW\*(C`\-\-extdirs\*(C'\fR was specified, append the contents of the
|
254 |
|
|
specified directories at the end of the class path. Otherwise, append
|
255 |
|
|
the contents of the built-in extdirs at \f(CW\*(C`$(prefix)/share/java/ext\*(C'\fR.
|
256 |
|
|
.PP
|
257 |
|
|
The classfile built by \fBgcj\fR for the class \f(CW\*(C`java.lang.Object\*(C'\fR
|
258 |
|
|
(and placed in \f(CW\*(C`libgcj.jar\*(C'\fR) contains a special zero length
|
259 |
|
|
attribute \f(CW\*(C`gnu.gcj.gcj\-compiled\*(C'\fR. The compiler looks for this
|
260 |
|
|
attribute when loading \f(CW\*(C`java.lang.Object\*(C'\fR and will report an error
|
261 |
|
|
if it isn't found, unless it compiles to bytecode (the option
|
262 |
|
|
\&\f(CW\*(C`\-fforce\-classes\-archive\-check\*(C'\fR can be used to override this
|
263 |
|
|
behavior in this particular case.)
|
264 |
|
|
.IP "\fB\-fforce\-classes\-archive\-check\fR" 4
|
265 |
|
|
.IX Item "-fforce-classes-archive-check"
|
266 |
|
|
This forces the compiler to always check for the special zero length
|
267 |
|
|
attribute \f(CW\*(C`gnu.gcj.gcj\-compiled\*(C'\fR in \f(CW\*(C`java.lang.Object\*(C'\fR and
|
268 |
|
|
issue an error if it isn't found.
|
269 |
|
|
.Sh "Encodings"
|
270 |
|
|
.IX Subsection "Encodings"
|
271 |
|
|
The Java programming language uses Unicode throughout. In an effort to
|
272 |
|
|
integrate well with other locales, \fBgcj\fR allows \fI.java\fR files
|
273 |
|
|
to be written using almost any encoding. \fBgcj\fR knows how to
|
274 |
|
|
convert these encodings into its internal encoding at compile time.
|
275 |
|
|
.PP
|
276 |
|
|
You can use the \f(CW\*(C`\-\-encoding=\f(CI\s-1NAME\s0\f(CW\*(C'\fR option to specify an
|
277 |
|
|
encoding (of a particular character set) to use for source files. If
|
278 |
|
|
this is not specified, the default encoding comes from your current
|
279 |
|
|
locale. If your host system has insufficient locale support, then
|
280 |
|
|
\&\fBgcj\fR assumes the default encoding to be the \fB\s-1UTF\-8\s0\fR encoding
|
281 |
|
|
of Unicode.
|
282 |
|
|
.PP
|
283 |
|
|
To implement \f(CW\*(C`\-\-encoding\*(C'\fR, \fBgcj\fR simply uses the host
|
284 |
|
|
platform's \f(CW\*(C`iconv\*(C'\fR conversion routine. This means that in practice
|
285 |
|
|
\&\fBgcj\fR is limited by the capabilities of the host platform.
|
286 |
|
|
.PP
|
287 |
|
|
The names allowed for the argument \f(CW\*(C`\-\-encoding\*(C'\fR vary from platform
|
288 |
|
|
to platform (since they are not standardized anywhere). However,
|
289 |
|
|
\&\fBgcj\fR implements the encoding named \fB\s-1UTF\-8\s0\fR internally, so if
|
290 |
|
|
you choose to use this for your source files you can be assured that it
|
291 |
|
|
will work on every host.
|
292 |
|
|
.Sh "Warnings"
|
293 |
|
|
.IX Subsection "Warnings"
|
294 |
|
|
\&\fBgcj\fR implements several warnings. As with other generic
|
295 |
|
|
\&\fBgcc\fR warnings, if an option of the form \f(CW\*(C`\-Wfoo\*(C'\fR enables a
|
296 |
|
|
warning, then \f(CW\*(C`\-Wno\-foo\*(C'\fR will disable it. Here we've chosen to
|
297 |
|
|
document the form of the warning which will have an effect \*(-- the
|
298 |
|
|
default being the opposite of what is listed.
|
299 |
|
|
.IP "\fB\-Wredundant\-modifiers\fR" 4
|
300 |
|
|
.IX Item "-Wredundant-modifiers"
|
301 |
|
|
With this flag, \fBgcj\fR will warn about redundant modifiers. For
|
302 |
|
|
instance, it will warn if an interface method is declared \f(CW\*(C`public\*(C'\fR.
|
303 |
|
|
.IP "\fB\-Wextraneous\-semicolon\fR" 4
|
304 |
|
|
.IX Item "-Wextraneous-semicolon"
|
305 |
|
|
This causes \fBgcj\fR to warn about empty statements. Empty statements
|
306 |
|
|
have been deprecated.
|
307 |
|
|
.IP "\fB\-Wno\-out\-of\-date\fR" 4
|
308 |
|
|
.IX Item "-Wno-out-of-date"
|
309 |
|
|
This option will cause \fBgcj\fR not to warn when a source file is
|
310 |
|
|
newer than its matching class file. By default \fBgcj\fR will warn
|
311 |
|
|
about this.
|
312 |
|
|
.IP "\fB\-Wno\-deprecated\fR" 4
|
313 |
|
|
.IX Item "-Wno-deprecated"
|
314 |
|
|
Warn if a deprecated class, method, or field is referred to.
|
315 |
|
|
.IP "\fB\-Wunused\fR" 4
|
316 |
|
|
.IX Item "-Wunused"
|
317 |
|
|
This is the same as \fBgcc\fR's \f(CW\*(C`\-Wunused\*(C'\fR.
|
318 |
|
|
.IP "\fB\-Wall\fR" 4
|
319 |
|
|
.IX Item "-Wall"
|
320 |
|
|
This is the same as \f(CW\*(C`\-Wredundant\-modifiers \-Wextraneous\-semicolon
|
321 |
|
|
\&\-Wunused\*(C'\fR.
|
322 |
|
|
.Sh "Linking"
|
323 |
|
|
.IX Subsection "Linking"
|
324 |
|
|
To turn a Java application into an executable program,
|
325 |
|
|
you need to link it with the needed libraries, just as for C or \*(C+.
|
326 |
|
|
The linker by default looks for a global function named \f(CW\*(C`main\*(C'\fR.
|
327 |
|
|
Since Java does not have global functions, and a
|
328 |
|
|
collection of Java classes may have more than one class with a
|
329 |
|
|
\&\f(CW\*(C`main\*(C'\fR method, you need to let the linker know which of those
|
330 |
|
|
\&\f(CW\*(C`main\*(C'\fR methods it should invoke when starting the application.
|
331 |
|
|
You can do that in any of these ways:
|
332 |
|
|
.IP "\(bu" 4
|
333 |
|
|
Specify the class containing the desired \f(CW\*(C`main\*(C'\fR method
|
334 |
|
|
when you link the application, using the \f(CW\*(C`\-\-main\*(C'\fR flag,
|
335 |
|
|
described below.
|
336 |
|
|
.IP "\(bu" 4
|
337 |
|
|
Link the Java package(s) into a shared library (dll) rather than an
|
338 |
|
|
executable. Then invoke the application using the \f(CW\*(C`gij\*(C'\fR program,
|
339 |
|
|
making sure that \f(CW\*(C`gij\*(C'\fR can find the libraries it needs.
|
340 |
|
|
.IP "\(bu" 4
|
341 |
|
|
Link the Java packages(s) with the flag \f(CW\*(C`\-lgij\*(C'\fR, which links
|
342 |
|
|
in the \f(CW\*(C`main\*(C'\fR routine from the \f(CW\*(C`gij\*(C'\fR command.
|
343 |
|
|
This allows you to select the class whose \f(CW\*(C`main\*(C'\fR method you
|
344 |
|
|
want to run when you run the application. You can also use
|
345 |
|
|
other \f(CW\*(C`gij\*(C'\fR flags, such as \f(CW\*(C`\-D\*(C'\fR flags to set properties.
|
346 |
|
|
Using the \f(CW\*(C`\-lgij\*(C'\fR library (rather than the \f(CW\*(C`gij\*(C'\fR program
|
347 |
|
|
of the previous mechanism) has some advantages: it is compatible with
|
348 |
|
|
static linking, and does not require configuring or installing libraries.
|
349 |
|
|
.PP
|
350 |
|
|
These \f(CW\*(C`gij\*(C'\fR options relate to linking an executable:
|
351 |
|
|
.IP "\fB\-\-main=\fR\fI\s-1CLASSNAME\s0\fR" 4
|
352 |
|
|
.IX Item "--main=CLASSNAME"
|
353 |
|
|
This option is used when linking to specify the name of the class whose
|
354 |
|
|
\&\f(CW\*(C`main\*(C'\fR method should be invoked when the resulting executable is
|
355 |
|
|
run.
|
356 |
|
|
.IP "\fB\-D\fR\fIname\fR\fB[=\fR\fIvalue\fR\fB]\fR" 4
|
357 |
|
|
.IX Item "-Dname[=value]"
|
358 |
|
|
This option can only be used with \f(CW\*(C`\-\-main\*(C'\fR. It defines a system
|
359 |
|
|
property named \fIname\fR with value \fIvalue\fR. If \fIvalue\fR is not
|
360 |
|
|
specified then it defaults to the empty string. These system properties
|
361 |
|
|
are initialized at the program's startup and can be retrieved at runtime
|
362 |
|
|
using the \f(CW\*(C`java.lang.System.getProperty\*(C'\fR method.
|
363 |
|
|
.IP "\fB\-lgij\fR" 4
|
364 |
|
|
.IX Item "-lgij"
|
365 |
|
|
Create an application whose command-line processing is that
|
366 |
|
|
of the \f(CW\*(C`gij\*(C'\fR command.
|
367 |
|
|
.Sp
|
368 |
|
|
This option is an alternative to using \f(CW\*(C`\-\-main\*(C'\fR; you cannot use both.
|
369 |
|
|
.IP "\fB\-static\-libgcj\fR" 4
|
370 |
|
|
.IX Item "-static-libgcj"
|
371 |
|
|
This option causes linking to be done against a static version of the
|
372 |
|
|
libgcj runtime library. This option is only available if
|
373 |
|
|
corresponding linker support exists.
|
374 |
|
|
.Sp
|
375 |
|
|
\&\fBCaution:\fR Static linking of libgcj may cause essential parts
|
376 |
|
|
of libgcj to be omitted. Some parts of libgcj use reflection to load
|
377 |
|
|
classes at runtime. Since the linker does not see these references at
|
378 |
|
|
link time, it can omit the referred to classes. The result is usually
|
379 |
|
|
(but not always) a \f(CW\*(C`ClassNotFoundException\*(C'\fR being thrown at
|
380 |
|
|
runtime. Caution must be used when using this option. For more
|
381 |
|
|
details see:
|
382 |
|
|
<\fBhttp://gcc.gnu.org/wiki/Statically%20linking%20libgcj\fR>
|
383 |
|
|
.Sh "Code Generation"
|
384 |
|
|
.IX Subsection "Code Generation"
|
385 |
|
|
In addition to the many \fBgcc\fR options controlling code generation,
|
386 |
|
|
\&\fBgcj\fR has several options specific to itself.
|
387 |
|
|
.IP "\fB\-C\fR" 4
|
388 |
|
|
.IX Item "-C"
|
389 |
|
|
This option is used to tell \fBgcj\fR to generate bytecode
|
390 |
|
|
(\fI.class\fR files) rather than object code.
|
391 |
|
|
.IP "\fB\-\-resource\fR \fIresource-name\fR" 4
|
392 |
|
|
.IX Item "--resource resource-name"
|
393 |
|
|
This option is used to tell \fBgcj\fR to compile the contents of a
|
394 |
|
|
given file to object code so it may be accessed at runtime with the core
|
395 |
|
|
protocol handler as \fBcore:/\fR\fIresource-name\fR. Note that
|
396 |
|
|
\&\fIresource-name\fR is the name of the resource as found at runtime; for
|
397 |
|
|
instance, it could be used in a call to \f(CW\*(C`ResourceBundle.getBundle\*(C'\fR.
|
398 |
|
|
The actual file name to be compiled this way must be specified
|
399 |
|
|
separately.
|
400 |
|
|
.IP "\fB\-d\fR \fIdirectory\fR" 4
|
401 |
|
|
.IX Item "-d directory"
|
402 |
|
|
When used with \f(CW\*(C`\-C\*(C'\fR, this causes all generated \fI.class\fR files
|
403 |
|
|
to be put in the appropriate subdirectory of \fIdirectory\fR. By
|
404 |
|
|
default they will be put in subdirectories of the current working
|
405 |
|
|
directory.
|
406 |
|
|
.IP "\fB\-fno\-bounds\-check\fR" 4
|
407 |
|
|
.IX Item "-fno-bounds-check"
|
408 |
|
|
By default, \fBgcj\fR generates code which checks the bounds of all
|
409 |
|
|
array indexing operations. With this option, these checks are omitted, which
|
410 |
|
|
can improve performance for code that uses arrays extensively. Note that this
|
411 |
|
|
can result in unpredictable behavior if the code in question actually does
|
412 |
|
|
violate array bounds constraints. It is safe to use this option if you are
|
413 |
|
|
sure that your code will never throw an \f(CW\*(C`ArrayIndexOutOfBoundsException\*(C'\fR.
|
414 |
|
|
.IP "\fB\-fno\-store\-check\fR" 4
|
415 |
|
|
.IX Item "-fno-store-check"
|
416 |
|
|
Don't generate array store checks. When storing objects into arrays, a runtime
|
417 |
|
|
check is normally generated in order to ensure that the object is assignment
|
418 |
|
|
compatible with the component type of the array (which may not be known
|
419 |
|
|
at compile\-time). With this option, these checks are omitted. This can
|
420 |
|
|
improve performance for code which stores objects into arrays frequently.
|
421 |
|
|
It is safe to use this option if you are sure your code will never throw an
|
422 |
|
|
\&\f(CW\*(C`ArrayStoreException\*(C'\fR.
|
423 |
|
|
.IP "\fB\-fjni\fR" 4
|
424 |
|
|
.IX Item "-fjni"
|
425 |
|
|
With \fBgcj\fR there are two options for writing native methods: \s-1CNI\s0
|
426 |
|
|
and \s-1JNI\s0. By default \fBgcj\fR assumes you are using \s-1CNI\s0. If you are
|
427 |
|
|
compiling a class with native methods, and these methods are implemented
|
428 |
|
|
using \s-1JNI\s0, then you must use \f(CW\*(C`\-fjni\*(C'\fR. This option causes
|
429 |
|
|
\&\fBgcj\fR to generate stubs which will invoke the underlying \s-1JNI\s0
|
430 |
|
|
methods.
|
431 |
|
|
.IP "\fB\-fno\-assert\fR" 4
|
432 |
|
|
.IX Item "-fno-assert"
|
433 |
|
|
Don't recognize the \f(CW\*(C`assert\*(C'\fR keyword. This is for compatibility
|
434 |
|
|
with older versions of the language specification.
|
435 |
|
|
.IP "\fB\-fno\-optimize\-static\-class\-initialization\fR" 4
|
436 |
|
|
.IX Item "-fno-optimize-static-class-initialization"
|
437 |
|
|
When the optimization level is greater or equal to \f(CW\*(C`\-O2\*(C'\fR,
|
438 |
|
|
\&\fBgcj\fR will try to optimize the way calls into the runtime are made
|
439 |
|
|
to initialize static classes upon their first use (this optimization
|
440 |
|
|
isn't carried out if \f(CW\*(C`\-C\*(C'\fR was specified.) When compiling to native
|
441 |
|
|
code, \f(CW\*(C`\-fno\-optimize\-static\-class\-initialization\*(C'\fR will turn this
|
442 |
|
|
optimization off, regardless of the optimization level in use.
|
443 |
|
|
.IP "\fB\-\-disable\-assertions[=\fR\fIclass-or-package\fR\fB]\fR" 4
|
444 |
|
|
.IX Item "--disable-assertions[=class-or-package]"
|
445 |
|
|
Don't include code for checking assertions in the compiled code.
|
446 |
|
|
If \f(CW\*(C`=\f(CIclass-or-package\f(CW\*(C'\fR is missing disables assertion code
|
447 |
|
|
generation for all classes, unless overridden by a more
|
448 |
|
|
specific \f(CW\*(C`\-\-enable\-assertions\*(C'\fR flag.
|
449 |
|
|
If \fIclass-or-package\fR is a class name, only disables generating
|
450 |
|
|
assertion checks within the named class or its inner classes.
|
451 |
|
|
If \fIclass-or-package\fR is a package name, disables generating
|
452 |
|
|
assertion checks within the named package or a subpackage.
|
453 |
|
|
.Sp
|
454 |
|
|
By default, assertions are enabled when generating class files
|
455 |
|
|
or when not optimizing, and disabled when generating optimized binaries.
|
456 |
|
|
.IP "\fB\-\-enable\-assertions[=\fR\fIclass-or-package\fR\fB]\fR" 4
|
457 |
|
|
.IX Item "--enable-assertions[=class-or-package]"
|
458 |
|
|
Generates code to check assertions. The option is perhaps misnamed,
|
459 |
|
|
as you still need to turn on assertion checking at run\-time,
|
460 |
|
|
and we don't support any easy way to do that.
|
461 |
|
|
So this flag isn't very useful yet, except to partially override
|
462 |
|
|
\&\f(CW\*(C`\-\-disable\-assertions\*(C'\fR.
|
463 |
|
|
.IP "\fB\-findirect\-dispatch\fR" 4
|
464 |
|
|
.IX Item "-findirect-dispatch"
|
465 |
|
|
\&\fBgcj\fR has a special binary compatibility \s-1ABI\s0, which is enabled
|
466 |
|
|
by the \f(CW\*(C`\-findirect\-dispatch\*(C'\fR option. In this mode, the code
|
467 |
|
|
generated by \fBgcj\fR honors the binary compatibility guarantees
|
468 |
|
|
in the Java Language Specification, and the resulting object files do
|
469 |
|
|
not need to be directly linked against their dependencies. Instead,
|
470 |
|
|
all dependencies are looked up at runtime. This allows free mixing of
|
471 |
|
|
interpreted and compiled code.
|
472 |
|
|
.Sp
|
473 |
|
|
Note that, at present, \f(CW\*(C`\-findirect\-dispatch\*(C'\fR can only be used
|
474 |
|
|
when compiling \fI.class\fR files. It will not work when compiling
|
475 |
|
|
from source. \s-1CNI\s0 also does not yet work with the binary compatibility
|
476 |
|
|
\&\s-1ABI\s0. These restrictions will be lifted in some future release.
|
477 |
|
|
.Sp
|
478 |
|
|
However, if you compile \s-1CNI\s0 code with the standard \s-1ABI\s0, you can call
|
479 |
|
|
it from code built with the binary compatibility \s-1ABI\s0.
|
480 |
|
|
.IP "\fB\-fbootstrap\-classes\fR" 4
|
481 |
|
|
.IX Item "-fbootstrap-classes"
|
482 |
|
|
This option can be use to tell \f(CW\*(C`libgcj\*(C'\fR that the compiled classes
|
483 |
|
|
should be loaded by the bootstrap loader, not the system class loader.
|
484 |
|
|
By default, if you compile a class and link it into an executable, it
|
485 |
|
|
will be treated as if it was loaded using the system class loader.
|
486 |
|
|
This is convenient, as it means that things like
|
487 |
|
|
\&\f(CW\*(C`Class.forName()\*(C'\fR will search \fB\s-1CLASSPATH\s0\fR to find the
|
488 |
|
|
desired class.
|
489 |
|
|
.IP "\fB\-freduced\-reflection\fR" 4
|
490 |
|
|
.IX Item "-freduced-reflection"
|
491 |
|
|
This option causes the code generated by \fBgcj\fR to contain a
|
492 |
|
|
reduced amount of the class meta-data used to support runtime
|
493 |
|
|
reflection. The cost of this savings is the loss of
|
494 |
|
|
the ability to use certain reflection capabilities of the standard
|
495 |
|
|
Java runtime environment. When set all meta-data except for that
|
496 |
|
|
which is needed to obtain correct runtime semantics is eliminated.
|
497 |
|
|
.Sp
|
498 |
|
|
For code that does not use reflection (i.e. the methods in the
|
499 |
|
|
\&\f(CW\*(C`java.lang.reflect\*(C'\fR package), \f(CW\*(C`\-freduced\-reflection\*(C'\fR
|
500 |
|
|
will result in proper operation with a savings in executable code size.
|
501 |
|
|
.Sp
|
502 |
|
|
\&\s-1JNI\s0 (\f(CW\*(C`\-fjni\*(C'\fR) and the binary compatibility \s-1ABI\s0
|
503 |
|
|
(\f(CW\*(C`\-findirect\-dispatch\*(C'\fR) do not work properly without full
|
504 |
|
|
reflection meta\-data. Because of this, it is an error to use these options
|
505 |
|
|
with \f(CW\*(C`\-freduced\-reflection\*(C'\fR.
|
506 |
|
|
.Sp
|
507 |
|
|
\&\fBCaution:\fR If there is no reflection meta\-data, code that uses
|
508 |
|
|
a \f(CW\*(C`SecurityManager\*(C'\fR may not work properly. Also calling
|
509 |
|
|
\&\f(CW\*(C`Class.forName()\*(C'\fR may fail if the calling method has no
|
510 |
|
|
reflection meta\-data.
|
511 |
|
|
.Sh "Configure-time Options"
|
512 |
|
|
.IX Subsection "Configure-time Options"
|
513 |
|
|
Some \fBgcj\fR code generations options affect the resulting \s-1ABI\s0, and
|
514 |
|
|
so can only be meaningfully given when \f(CW\*(C`libgcj\*(C'\fR, the runtime
|
515 |
|
|
package, is configured. \f(CW\*(C`libgcj\*(C'\fR puts the appropriate options from
|
516 |
|
|
this group into a \fBspec\fR file which is read by \fBgcj\fR. These
|
517 |
|
|
options are listed here for completeness; if you are using \f(CW\*(C`libgcj\*(C'\fR
|
518 |
|
|
then you won't want to touch these options.
|
519 |
|
|
.IP "\fB\-fuse\-boehm\-gc\fR" 4
|
520 |
|
|
.IX Item "-fuse-boehm-gc"
|
521 |
|
|
This enables the use of the Boehm \s-1GC\s0 bitmap marking code. In particular
|
522 |
|
|
this causes \fBgcj\fR to put an object marking descriptor into each
|
523 |
|
|
vtable.
|
524 |
|
|
.IP "\fB\-fhash\-synchronization\fR" 4
|
525 |
|
|
.IX Item "-fhash-synchronization"
|
526 |
|
|
By default, synchronization data (the data used for \f(CW\*(C`synchronize\*(C'\fR,
|
527 |
|
|
\&\f(CW\*(C`wait\*(C'\fR, and \f(CW\*(C`notify\*(C'\fR) is pointed to by a word in each object.
|
528 |
|
|
With this option \fBgcj\fR assumes that this information is stored in a
|
529 |
|
|
hash table and not in the object itself.
|
530 |
|
|
.IP "\fB\-fuse\-divide\-subroutine\fR" 4
|
531 |
|
|
.IX Item "-fuse-divide-subroutine"
|
532 |
|
|
On some systems, a library routine is called to perform integer
|
533 |
|
|
division. This is required to get exception handling correct when
|
534 |
|
|
dividing by zero.
|
535 |
|
|
.IP "\fB\-fcheck\-references\fR" 4
|
536 |
|
|
.IX Item "-fcheck-references"
|
537 |
|
|
On some systems it's necessary to insert inline checks whenever
|
538 |
|
|
accessing an object via a reference. On other systems you won't need
|
539 |
|
|
this because null pointer accesses are caught automatically by the
|
540 |
|
|
processor.
|
541 |
|
|
.SH "SEE ALSO"
|
542 |
|
|
.IX Header "SEE ALSO"
|
543 |
|
|
\&\fIgcc\fR\|(1), \fIgcjh\fR\|(1), \fIgjnih\fR\|(1), \fIgij\fR\|(1), \fIjv\-scan\fR\|(1), \fIjcf\-dump\fR\|(1), \fIgfdl\fR\|(7),
|
544 |
|
|
and the Info entries for \fIgcj\fR and \fIgcc\fR.
|
545 |
|
|
.SH "COPYRIGHT"
|
546 |
|
|
.IX Header "COPYRIGHT"
|
547 |
|
|
Copyright (c) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
548 |
|
|
.PP
|
549 |
|
|
Permission is granted to copy, distribute and/or modify this document
|
550 |
|
|
under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.2 or
|
551 |
|
|
any later version published by the Free Software Foundation; with the
|
552 |
|
|
Invariant Sections being \*(L"\s-1GNU\s0 General Public License\*(R", the Front-Cover
|
553 |
|
|
texts being (a) (see below), and with the Back-Cover Texts being (b)
|
554 |
|
|
(see below). A copy of the license is included in the
|
555 |
|
|
man page \fIgfdl\fR\|(7).
|
556 |
|
|
.PP
|
557 |
|
|
(a) The \s-1FSF\s0's Front-Cover Text is:
|
558 |
|
|
.PP
|
559 |
|
|
.Vb 1
|
560 |
|
|
\& A GNU Manual
|
561 |
|
|
.Ve
|
562 |
|
|
.PP
|
563 |
|
|
(b) The \s-1FSF\s0's Back-Cover Text is:
|
564 |
|
|
.PP
|
565 |
|
|
.Vb 3
|
566 |
|
|
\& You have freedom to copy and modify this GNU Manual, like GNU
|
567 |
|
|
\& software. Copies published by the Free Software Foundation raise
|
568 |
|
|
\& funds for GNU development.
|
569 |
|
|
.Ve
|