OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [doc/] [gcj.info] - Blame information for rev 16

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
This is doc/gcj.info, produced by makeinfo version 4.8 from
2
/scratch/mitchell/gcc-releases/gcc-4.1.1/gcc-4.1.1/gcc/java/gcj.texi.
3
 
4
   Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
5
Inc.
6
 
7
   Permission is granted to copy, distribute and/or modify this document
8
under the terms of the GNU Free Documentation License, Version 1.2 or
9
any later version published by the Free Software Foundation; with the
10
Invariant Sections being "GNU General Public License", the Front-Cover
11
texts being (a) (see below), and with the Back-Cover Texts being (b)
12
(see below).  A copy of the license is included in the section entitled
13
"GNU Free Documentation License".
14
 
15
   (a) The FSF's Front-Cover Text is:
16
 
17
   A GNU Manual
18
 
19
   (b) The FSF's Back-Cover Text is:
20
 
21
   You have freedom to copy and modify this GNU Manual, like GNU
22
software.  Copies published by the Free Software Foundation raise
23
funds for GNU development.
24
 
25
INFO-DIR-SECTION Programming
26
START-INFO-DIR-ENTRY
27
* Gcj: (gcj).               Ahead-of-time compiler for the Java language
28
END-INFO-DIR-ENTRY
29
 
30
INFO-DIR-SECTION Individual utilities
31
START-INFO-DIR-ENTRY
32
* gcjh: (gcj)Invoking gcjh.
33
                            Generate header files from Java class files
34
* gjnih: (gcj)Invoking gjnih.
35
                            Generate JNI header files from Java class files
36
* jv-scan: (gcj)Invoking jv-scan.
37
                            Print information about Java source files
38
* jcf-dump: (gcj)Invoking jcf-dump.
39
                            Print information about Java class files
40
* gij: (gcj)Invoking gij.   GNU interpreter for Java bytecode
41
* gcj-dbtool: (gcj)Invoking gcj-dbtool.
42
                            Tool for manipulating class file databases.
43
* jv-convert: (gcj)Invoking jv-convert.
44
                            Convert file from one encoding to another
45
* grmic: (gcj)Invoking grmic.
46
                            Generate stubs for Remote Method Invocation.
47
* grmiregistry: (gcj)Invoking grmiregistry.
48
                            The remote object registry.
49
END-INFO-DIR-ENTRY
50
 
51
   Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
52
Inc.
53
 
54
   Permission is granted to copy, distribute and/or modify this document
55
under the terms of the GNU Free Documentation License, Version 1.2 or
56
any later version published by the Free Software Foundation; with the
57
Invariant Sections being "GNU General Public License", the Front-Cover
58
texts being (a) (see below), and with the Back-Cover Texts being (b)
59
(see below).  A copy of the license is included in the section entitled
60
"GNU Free Documentation License".
61
 
62
   (a) The FSF's Front-Cover Text is:
63
 
64
   A GNU Manual
65
 
66
   (b) The FSF's Back-Cover Text is:
67
 
68
   You have freedom to copy and modify this GNU Manual, like GNU
69
software.  Copies published by the Free Software Foundation raise
70
funds for GNU development.
71
 
72

73
File: gcj.info,  Node: Top,  Next: Copying,  Up: (dir)
74
 
75
Introduction
76
************
77
 
78
This manual describes how to use `gcj', the GNU compiler for the Java
79
programming language.  `gcj' can generate both `.class' files and
80
object files, and it can read both Java source code and `.class' files.
81
 
82
* Menu:
83
 
84
* Copying::              The GNU General Public License
85
* GNU Free Documentation License::
86
                        How you can share and copy this manual
87
* Invoking gcj::        Compiler options supported by `gcj'
88
* Compatibility::       Compatibility between gcj and other tools for Java
89
* Invoking gcjh::       Generate header files from class files
90
* Invoking gjnih::      Generate JNI header files from class files
91
* Invoking jv-scan::    Print information about source files
92
* Invoking jcf-dump::   Print information about class files
93
* Invoking gij::        Interpreting Java bytecodes
94
* Invoking gcj-dbtool:: Tool for manipulating class file databases.
95
* Invoking jv-convert:: Converting from one encoding to another
96
* Invoking grmic::      Generate stubs for Remote Method Invocation.
97
* Invoking grmiregistry:: The remote object registry.
98
* About CNI::           Description of the Compiled Native Interface
99
* System properties::   Modifying runtime behavior of the libgcj library
100
* Resources::           Where to look for more information
101
* Index::               Index.
102
 
103

104
File: gcj.info,  Node: Copying,  Next: GNU Free Documentation License,  Prev: Top,  Up: Top
105
 
106
GNU GENERAL PUBLIC LICENSE
107
**************************
108
 
109
                         Version 2, June 1991
110
 
111
     Copyright (C) 1989, 1991 Free Software Foundation, Inc.
112
     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
113
 
114
     Everyone is permitted to copy and distribute verbatim copies
115
     of this license document, but changing it is not allowed.
116
 
117
Preamble
118
========
119
 
120
The licenses for most software are designed to take away your freedom
121
to share and change it.  By contrast, the GNU General Public License is
122
intended to guarantee your freedom to share and change free
123
software--to make sure the software is free for all its users.  This
124
General Public License applies to most of the Free Software
125
Foundation's software and to any other program whose authors commit to
126
using it.  (Some other Free Software Foundation software is covered by
127
the GNU Library General Public License instead.)  You can apply it to
128
your programs, too.
129
 
130
   When we speak of free software, we are referring to freedom, not
131
price.  Our General Public Licenses are designed to make sure that you
132
have the freedom to distribute copies of free software (and charge for
133
this service if you wish), that you receive source code or can get it
134
if you want it, that you can change the software or use pieces of it in
135
new free programs; and that you know you can do these things.
136
 
137
   To protect your rights, we need to make restrictions that forbid
138
anyone to deny you these rights or to ask you to surrender the rights.
139
These restrictions translate to certain responsibilities for you if you
140
distribute copies of the software, or if you modify it.
141
 
142
   For example, if you distribute copies of such a program, whether
143
gratis or for a fee, you must give the recipients all the rights that
144
you have.  You must make sure that they, too, receive or can get the
145
source code.  And you must show them these terms so they know their
146
rights.
147
 
148
   We protect your rights with two steps: (1) copyright the software,
149
and (2) offer you this license which gives you legal permission to copy,
150
distribute and/or modify the software.
151
 
152
   Also, for each author's protection and ours, we want to make certain
153
that everyone understands that there is no warranty for this free
154
software.  If the software is modified by someone else and passed on, we
155
want its recipients to know that what they have is not the original, so
156
that any problems introduced by others will not reflect on the original
157
authors' reputations.
158
 
159
   Finally, any free program is threatened constantly by software
160
patents.  We wish to avoid the danger that redistributors of a free
161
program will individually obtain patent licenses, in effect making the
162
program proprietary.  To prevent this, we have made it clear that any
163
patent must be licensed for everyone's free use or not licensed at all.
164
 
165
   The precise terms and conditions for copying, distribution and
166
modification follow.
167
 
168
    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
169
  0. This License applies to any program or other work which contains a
170
     notice placed by the copyright holder saying it may be distributed
171
     under the terms of this General Public License.  The "Program",
172
     below, refers to any such program or work, and a "work based on
173
     the Program" means either the Program or any derivative work under
174
     copyright law: that is to say, a work containing the Program or a
175
     portion of it, either verbatim or with modifications and/or
176
     translated into another language.  (Hereinafter, translation is
177
     included without limitation in the term "modification".)  Each
178
     licensee is addressed as "you".
179
 
180
     Activities other than copying, distribution and modification are
181
     not covered by this License; they are outside its scope.  The act
182
     of running the Program is not restricted, and the output from the
183
     Program is covered only if its contents constitute a work based on
184
     the Program (independent of having been made by running the
185
     Program).  Whether that is true depends on what the Program does.
186
 
187
  1. You may copy and distribute verbatim copies of the Program's
188
     source code as you receive it, in any medium, provided that you
189
     conspicuously and appropriately publish on each copy an appropriate
190
     copyright notice and disclaimer of warranty; keep intact all the
191
     notices that refer to this License and to the absence of any
192
     warranty; and give any other recipients of the Program a copy of
193
     this License along with the Program.
194
 
195
     You may charge a fee for the physical act of transferring a copy,
196
     and you may at your option offer warranty protection in exchange
197
     for a fee.
198
 
199
  2. You may modify your copy or copies of the Program or any portion
200
     of it, thus forming a work based on the Program, and copy and
201
     distribute such modifications or work under the terms of Section 1
202
     above, provided that you also meet all of these conditions:
203
 
204
       a. You must cause the modified files to carry prominent notices
205
          stating that you changed the files and the date of any change.
206
 
207
       b. You must cause any work that you distribute or publish, that
208
          in whole or in part contains or is derived from the Program
209
          or any part thereof, to be licensed as a whole at no charge
210
          to all third parties under the terms of this License.
211
 
212
       c. If the modified program normally reads commands interactively
213
          when run, you must cause it, when started running for such
214
          interactive use in the most ordinary way, to print or display
215
          an announcement including an appropriate copyright notice and
216
          a notice that there is no warranty (or else, saying that you
217
          provide a warranty) and that users may redistribute the
218
          program under these conditions, and telling the user how to
219
          view a copy of this License.  (Exception: if the Program
220
          itself is interactive but does not normally print such an
221
          announcement, your work based on the Program is not required
222
          to print an announcement.)
223
 
224
     These requirements apply to the modified work as a whole.  If
225
     identifiable sections of that work are not derived from the
226
     Program, and can be reasonably considered independent and separate
227
     works in themselves, then this License, and its terms, do not
228
     apply to those sections when you distribute them as separate
229
     works.  But when you distribute the same sections as part of a
230
     whole which is a work based on the Program, the distribution of
231
     the whole must be on the terms of this License, whose permissions
232
     for other licensees extend to the entire whole, and thus to each
233
     and every part regardless of who wrote it.
234
 
235
     Thus, it is not the intent of this section to claim rights or
236
     contest your rights to work written entirely by you; rather, the
237
     intent is to exercise the right to control the distribution of
238
     derivative or collective works based on the Program.
239
 
240
     In addition, mere aggregation of another work not based on the
241
     Program with the Program (or with a work based on the Program) on
242
     a volume of a storage or distribution medium does not bring the
243
     other work under the scope of this License.
244
 
245
  3. You may copy and distribute the Program (or a work based on it,
246
     under Section 2) in object code or executable form under the terms
247
     of Sections 1 and 2 above provided that you also do one of the
248
     following:
249
 
250
       a. Accompany it with the complete corresponding machine-readable
251
          source code, which must be distributed under the terms of
252
          Sections 1 and 2 above on a medium customarily used for
253
          software interchange; or,
254
 
255
       b. Accompany it with a written offer, valid for at least three
256
          years, to give any third party, for a charge no more than your
257
          cost of physically performing source distribution, a complete
258
          machine-readable copy of the corresponding source code, to be
259
          distributed under the terms of Sections 1 and 2 above on a
260
          medium customarily used for software interchange; or,
261
 
262
       c. Accompany it with the information you received as to the offer
263
          to distribute corresponding source code.  (This alternative is
264
          allowed only for noncommercial distribution and only if you
265
          received the program in object code or executable form with
266
          such an offer, in accord with Subsection b above.)
267
 
268
     The source code for a work means the preferred form of the work for
269
     making modifications to it.  For an executable work, complete
270
     source code means all the source code for all modules it contains,
271
     plus any associated interface definition files, plus the scripts
272
     used to control compilation and installation of the executable.
273
     However, as a special exception, the source code distributed need
274
     not include anything that is normally distributed (in either
275
     source or binary form) with the major components (compiler,
276
     kernel, and so on) of the operating system on which the executable
277
     runs, unless that component itself accompanies the executable.
278
 
279
     If distribution of executable or object code is made by offering
280
     access to copy from a designated place, then offering equivalent
281
     access to copy the source code from the same place counts as
282
     distribution of the source code, even though third parties are not
283
     compelled to copy the source along with the object code.
284
 
285
  4. You may not copy, modify, sublicense, or distribute the Program
286
     except as expressly provided under this License.  Any attempt
287
     otherwise to copy, modify, sublicense or distribute the Program is
288
     void, and will automatically terminate your rights under this
289
     License.  However, parties who have received copies, or rights,
290
     from you under this License will not have their licenses
291
     terminated so long as such parties remain in full compliance.
292
 
293
  5. You are not required to accept this License, since you have not
294
     signed it.  However, nothing else grants you permission to modify
295
     or distribute the Program or its derivative works.  These actions
296
     are prohibited by law if you do not accept this License.
297
     Therefore, by modifying or distributing the Program (or any work
298
     based on the Program), you indicate your acceptance of this
299
     License to do so, and all its terms and conditions for copying,
300
     distributing or modifying the Program or works based on it.
301
 
302
  6. Each time you redistribute the Program (or any work based on the
303
     Program), the recipient automatically receives a license from the
304
     original licensor to copy, distribute or modify the Program
305
     subject to these terms and conditions.  You may not impose any
306
     further restrictions on the recipients' exercise of the rights
307
     granted herein.  You are not responsible for enforcing compliance
308
     by third parties to this License.
309
 
310
  7. If, as a consequence of a court judgment or allegation of patent
311
     infringement or for any other reason (not limited to patent
312
     issues), conditions are imposed on you (whether by court order,
313
     agreement or otherwise) that contradict the conditions of this
314
     License, they do not excuse you from the conditions of this
315
     License.  If you cannot distribute so as to satisfy simultaneously
316
     your obligations under this License and any other pertinent
317
     obligations, then as a consequence you may not distribute the
318
     Program at all.  For example, if a patent license would not permit
319
     royalty-free redistribution of the Program by all those who
320
     receive copies directly or indirectly through you, then the only
321
     way you could satisfy both it and this License would be to refrain
322
     entirely from distribution of the Program.
323
 
324
     If any portion of this section is held invalid or unenforceable
325
     under any particular circumstance, the balance of the section is
326
     intended to apply and the section as a whole is intended to apply
327
     in other circumstances.
328
 
329
     It is not the purpose of this section to induce you to infringe any
330
     patents or other property right claims or to contest validity of
331
     any such claims; this section has the sole purpose of protecting
332
     the integrity of the free software distribution system, which is
333
     implemented by public license practices.  Many people have made
334
     generous contributions to the wide range of software distributed
335
     through that system in reliance on consistent application of that
336
     system; it is up to the author/donor to decide if he or she is
337
     willing to distribute software through any other system and a
338
     licensee cannot impose that choice.
339
 
340
     This section is intended to make thoroughly clear what is believed
341
     to be a consequence of the rest of this License.
342
 
343
  8. If the distribution and/or use of the Program is restricted in
344
     certain countries either by patents or by copyrighted interfaces,
345
     the original copyright holder who places the Program under this
346
     License may add an explicit geographical distribution limitation
347
     excluding those countries, so that distribution is permitted only
348
     in or among countries not thus excluded.  In such case, this
349
     License incorporates the limitation as if written in the body of
350
     this License.
351
 
352
  9. The Free Software Foundation may publish revised and/or new
353
     versions of the General Public License from time to time.  Such
354
     new versions will be similar in spirit to the present version, but
355
     may differ in detail to address new problems or concerns.
356
 
357
     Each version is given a distinguishing version number.  If the
358
     Program specifies a version number of this License which applies
359
     to it and "any later version", you have the option of following
360
     the terms and conditions either of that version or of any later
361
     version published by the Free Software Foundation.  If the Program
362
     does not specify a version number of this License, you may choose
363
     any version ever published by the Free Software Foundation.
364
 
365
 10. If you wish to incorporate parts of the Program into other free
366
     programs whose distribution conditions are different, write to the
367
     author to ask for permission.  For software which is copyrighted
368
     by the Free Software Foundation, write to the Free Software
369
     Foundation; we sometimes make exceptions for this.  Our decision
370
     will be guided by the two goals of preserving the free status of
371
     all derivatives of our free software and of promoting the sharing
372
     and reuse of software generally.
373
 
374
                                NO WARRANTY
375
 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
376
     WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
377
     LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
378
     HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
379
     WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT
380
     NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
381
     FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE
382
     QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
383
     PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
384
     SERVICING, REPAIR OR CORRECTION.
385
 
386
 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
387
     WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY
388
     MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE
389
     LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
390
     INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
391
     INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
392
     DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU
393
     OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
394
     OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN
395
     ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
396
 
397
                      END OF TERMS AND CONDITIONS
398
Appendix: How to Apply These Terms to Your New Programs
399
=======================================================
400
 
401
If you develop a new program, and you want it to be of the greatest
402
possible use to the public, the best way to achieve this is to make it
403
free software which everyone can redistribute and change under these
404
terms.
405
 
406
   To do so, attach the following notices to the program.  It is safest
407
to attach them to the start of each source file to most effectively
408
convey the exclusion of warranty; and each file should have at least
409
the "copyright" line and a pointer to where the full notice is found.
410
 
411
     ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES.
412
     Copyright (C) YEAR  NAME OF AUTHOR
413
 
414
     This program is free software; you can redistribute it and/or modify
415
     it under the terms of the GNU General Public License as published by
416
     the Free Software Foundation; either version 2 of the License, or
417
     (at your option) any later version.
418
 
419
     This program is distributed in the hope that it will be useful,
420
     but WITHOUT ANY WARRANTY; without even the implied warranty of
421
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
422
     GNU General Public License for more details.
423
 
424
     You should have received a copy of the GNU General Public License
425
     along with this program; if not, write to the Free Software
426
     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
427
 
428
   Also add information on how to contact you by electronic and paper
429
mail.
430
 
431
   If the program is interactive, make it output a short notice like
432
this when it starts in an interactive mode:
433
 
434
     Gnomovision version 69, Copyright (C) YEAR NAME OF AUTHOR
435
     Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
436
     type `show w'.
437
     This is free software, and you are welcome to redistribute it
438
     under certain conditions; type `show c' for details.
439
 
440
   The hypothetical commands `show w' and `show c' should show the
441
appropriate parts of the General Public License.  Of course, the
442
commands you use may be called something other than `show w' and `show
443
c'; they could even be mouse-clicks or menu items--whatever suits your
444
program.
445
 
446
   You should also get your employer (if you work as a programmer) or
447
your school, if any, to sign a "copyright disclaimer" for the program,
448
if necessary.  Here is a sample; alter the names:
449
 
450
     Yoyodyne, Inc., hereby disclaims all copyright interest in the program
451
     `Gnomovision' (which makes passes at compilers) written by James Hacker.
452
 
453
     SIGNATURE OF TY COON, 1 April 1989
454
     Ty Coon, President of Vice
455
 
456
   This General Public License does not permit incorporating your
457
program into proprietary programs.  If your program is a subroutine
458
library, you may consider it more useful to permit linking proprietary
459
applications with the library.  If this is what you want to do, use the
460
GNU Library General Public License instead of this License.
461
 
462

463
File: gcj.info,  Node: GNU Free Documentation License,  Next: Invoking gcj,  Prev: Copying,  Up: Top
464
 
465
GNU Free Documentation License
466
******************************
467
 
468
                      Version 1.2, November 2002
469
 
470
     Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
471
     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
472
 
473
     Everyone is permitted to copy and distribute verbatim copies
474
     of this license document, but changing it is not allowed.
475
 
476
  0. PREAMBLE
477
 
478
     The purpose of this License is to make a manual, textbook, or other
479
     functional and useful document "free" in the sense of freedom: to
480
     assure everyone the effective freedom to copy and redistribute it,
481
     with or without modifying it, either commercially or
482
     noncommercially.  Secondarily, this License preserves for the
483
     author and publisher a way to get credit for their work, while not
484
     being considered responsible for modifications made by others.
485
 
486
     This License is a kind of "copyleft", which means that derivative
487
     works of the document must themselves be free in the same sense.
488
     It complements the GNU General Public License, which is a copyleft
489
     license designed for free software.
490
 
491
     We have designed this License in order to use it for manuals for
492
     free software, because free software needs free documentation: a
493
     free program should come with manuals providing the same freedoms
494
     that the software does.  But this License is not limited to
495
     software manuals; it can be used for any textual work, regardless
496
     of subject matter or whether it is published as a printed book.
497
     We recommend this License principally for works whose purpose is
498
     instruction or reference.
499
 
500
  1. APPLICABILITY AND DEFINITIONS
501
 
502
     This License applies to any manual or other work, in any medium,
503
     that contains a notice placed by the copyright holder saying it
504
     can be distributed under the terms of this License.  Such a notice
505
     grants a world-wide, royalty-free license, unlimited in duration,
506
     to use that work under the conditions stated herein.  The
507
     "Document", below, refers to any such manual or work.  Any member
508
     of the public is a licensee, and is addressed as "you".  You
509
     accept the license if you copy, modify or distribute the work in a
510
     way requiring permission under copyright law.
511
 
512
     A "Modified Version" of the Document means any work containing the
513
     Document or a portion of it, either copied verbatim, or with
514
     modifications and/or translated into another language.
515
 
516
     A "Secondary Section" is a named appendix or a front-matter section
517
     of the Document that deals exclusively with the relationship of the
518
     publishers or authors of the Document to the Document's overall
519
     subject (or to related matters) and contains nothing that could
520
     fall directly within that overall subject.  (Thus, if the Document
521
     is in part a textbook of mathematics, a Secondary Section may not
522
     explain any mathematics.)  The relationship could be a matter of
523
     historical connection with the subject or with related matters, or
524
     of legal, commercial, philosophical, ethical or political position
525
     regarding them.
526
 
527
     The "Invariant Sections" are certain Secondary Sections whose
528
     titles are designated, as being those of Invariant Sections, in
529
     the notice that says that the Document is released under this
530
     License.  If a section does not fit the above definition of
531
     Secondary then it is not allowed to be designated as Invariant.
532
     The Document may contain zero Invariant Sections.  If the Document
533
     does not identify any Invariant Sections then there are none.
534
 
535
     The "Cover Texts" are certain short passages of text that are
536
     listed, as Front-Cover Texts or Back-Cover Texts, in the notice
537
     that says that the Document is released under this License.  A
538
     Front-Cover Text may be at most 5 words, and a Back-Cover Text may
539
     be at most 25 words.
540
 
541
     A "Transparent" copy of the Document means a machine-readable copy,
542
     represented in a format whose specification is available to the
543
     general public, that is suitable for revising the document
544
     straightforwardly with generic text editors or (for images
545
     composed of pixels) generic paint programs or (for drawings) some
546
     widely available drawing editor, and that is suitable for input to
547
     text formatters or for automatic translation to a variety of
548
     formats suitable for input to text formatters.  A copy made in an
549
     otherwise Transparent file format whose markup, or absence of
550
     markup, has been arranged to thwart or discourage subsequent
551
     modification by readers is not Transparent.  An image format is
552
     not Transparent if used for any substantial amount of text.  A
553
     copy that is not "Transparent" is called "Opaque".
554
 
555
     Examples of suitable formats for Transparent copies include plain
556
     ASCII without markup, Texinfo input format, LaTeX input format,
557
     SGML or XML using a publicly available DTD, and
558
     standard-conforming simple HTML, PostScript or PDF designed for
559
     human modification.  Examples of transparent image formats include
560
     PNG, XCF and JPG.  Opaque formats include proprietary formats that
561
     can be read and edited only by proprietary word processors, SGML or
562
     XML for which the DTD and/or processing tools are not generally
563
     available, and the machine-generated HTML, PostScript or PDF
564
     produced by some word processors for output purposes only.
565
 
566
     The "Title Page" means, for a printed book, the title page itself,
567
     plus such following pages as are needed to hold, legibly, the
568
     material this License requires to appear in the title page.  For
569
     works in formats which do not have any title page as such, "Title
570
     Page" means the text near the most prominent appearance of the
571
     work's title, preceding the beginning of the body of the text.
572
 
573
     A section "Entitled XYZ" means a named subunit of the Document
574
     whose title either is precisely XYZ or contains XYZ in parentheses
575
     following text that translates XYZ in another language.  (Here XYZ
576
     stands for a specific section name mentioned below, such as
577
     "Acknowledgements", "Dedications", "Endorsements", or "History".)
578
     To "Preserve the Title" of such a section when you modify the
579
     Document means that it remains a section "Entitled XYZ" according
580
     to this definition.
581
 
582
     The Document may include Warranty Disclaimers next to the notice
583
     which states that this License applies to the Document.  These
584
     Warranty Disclaimers are considered to be included by reference in
585
     this License, but only as regards disclaiming warranties: any other
586
     implication that these Warranty Disclaimers may have is void and
587
     has no effect on the meaning of this License.
588
 
589
  2. VERBATIM COPYING
590
 
591
     You may copy and distribute the Document in any medium, either
592
     commercially or noncommercially, provided that this License, the
593
     copyright notices, and the license notice saying this License
594
     applies to the Document are reproduced in all copies, and that you
595
     add no other conditions whatsoever to those of this License.  You
596
     may not use technical measures to obstruct or control the reading
597
     or further copying of the copies you make or distribute.  However,
598
     you may accept compensation in exchange for copies.  If you
599
     distribute a large enough number of copies you must also follow
600
     the conditions in section 3.
601
 
602
     You may also lend copies, under the same conditions stated above,
603
     and you may publicly display copies.
604
 
605
  3. COPYING IN QUANTITY
606
 
607
     If you publish printed copies (or copies in media that commonly
608
     have printed covers) of the Document, numbering more than 100, and
609
     the Document's license notice requires Cover Texts, you must
610
     enclose the copies in covers that carry, clearly and legibly, all
611
     these Cover Texts: Front-Cover Texts on the front cover, and
612
     Back-Cover Texts on the back cover.  Both covers must also clearly
613
     and legibly identify you as the publisher of these copies.  The
614
     front cover must present the full title with all words of the
615
     title equally prominent and visible.  You may add other material
616
     on the covers in addition.  Copying with changes limited to the
617
     covers, as long as they preserve the title of the Document and
618
     satisfy these conditions, can be treated as verbatim copying in
619
     other respects.
620
 
621
     If the required texts for either cover are too voluminous to fit
622
     legibly, you should put the first ones listed (as many as fit
623
     reasonably) on the actual cover, and continue the rest onto
624
     adjacent pages.
625
 
626
     If you publish or distribute Opaque copies of the Document
627
     numbering more than 100, you must either include a
628
     machine-readable Transparent copy along with each Opaque copy, or
629
     state in or with each Opaque copy a computer-network location from
630
     which the general network-using public has access to download
631
     using public-standard network protocols a complete Transparent
632
     copy of the Document, free of added material.  If you use the
633
     latter option, you must take reasonably prudent steps, when you
634
     begin distribution of Opaque copies in quantity, to ensure that
635
     this Transparent copy will remain thus accessible at the stated
636
     location until at least one year after the last time you
637
     distribute an Opaque copy (directly or through your agents or
638
     retailers) of that edition to the public.
639
 
640
     It is requested, but not required, that you contact the authors of
641
     the Document well before redistributing any large number of
642
     copies, to give them a chance to provide you with an updated
643
     version of the Document.
644
 
645
  4. MODIFICATIONS
646
 
647
     You may copy and distribute a Modified Version of the Document
648
     under the conditions of sections 2 and 3 above, provided that you
649
     release the Modified Version under precisely this License, with
650
     the Modified Version filling the role of the Document, thus
651
     licensing distribution and modification of the Modified Version to
652
     whoever possesses a copy of it.  In addition, you must do these
653
     things in the Modified Version:
654
 
655
       A. Use in the Title Page (and on the covers, if any) a title
656
          distinct from that of the Document, and from those of
657
          previous versions (which should, if there were any, be listed
658
          in the History section of the Document).  You may use the
659
          same title as a previous version if the original publisher of
660
          that version gives permission.
661
 
662
       B. List on the Title Page, as authors, one or more persons or
663
          entities responsible for authorship of the modifications in
664
          the Modified Version, together with at least five of the
665
          principal authors of the Document (all of its principal
666
          authors, if it has fewer than five), unless they release you
667
          from this requirement.
668
 
669
       C. State on the Title page the name of the publisher of the
670
          Modified Version, as the publisher.
671
 
672
       D. Preserve all the copyright notices of the Document.
673
 
674
       E. Add an appropriate copyright notice for your modifications
675
          adjacent to the other copyright notices.
676
 
677
       F. Include, immediately after the copyright notices, a license
678
          notice giving the public permission to use the Modified
679
          Version under the terms of this License, in the form shown in
680
          the Addendum below.
681
 
682
       G. Preserve in that license notice the full lists of Invariant
683
          Sections and required Cover Texts given in the Document's
684
          license notice.
685
 
686
       H. Include an unaltered copy of this License.
687
 
688
       I. Preserve the section Entitled "History", Preserve its Title,
689
          and add to it an item stating at least the title, year, new
690
          authors, and publisher of the Modified Version as given on
691
          the Title Page.  If there is no section Entitled "History" in
692
          the Document, create one stating the title, year, authors,
693
          and publisher of the Document as given on its Title Page,
694
          then add an item describing the Modified Version as stated in
695
          the previous sentence.
696
 
697
       J. Preserve the network location, if any, given in the Document
698
          for public access to a Transparent copy of the Document, and
699
          likewise the network locations given in the Document for
700
          previous versions it was based on.  These may be placed in
701
          the "History" section.  You may omit a network location for a
702
          work that was published at least four years before the
703
          Document itself, or if the original publisher of the version
704
          it refers to gives permission.
705
 
706
       K. For any section Entitled "Acknowledgements" or "Dedications",
707
          Preserve the Title of the section, and preserve in the
708
          section all the substance and tone of each of the contributor
709
          acknowledgements and/or dedications given therein.
710
 
711
       L. Preserve all the Invariant Sections of the Document,
712
          unaltered in their text and in their titles.  Section numbers
713
          or the equivalent are not considered part of the section
714
          titles.
715
 
716
       M. Delete any section Entitled "Endorsements".  Such a section
717
          may not be included in the Modified Version.
718
 
719
       N. Do not retitle any existing section to be Entitled
720
          "Endorsements" or to conflict in title with any Invariant
721
          Section.
722
 
723
       O. Preserve any Warranty Disclaimers.
724
 
725
     If the Modified Version includes new front-matter sections or
726
     appendices that qualify as Secondary Sections and contain no
727
     material copied from the Document, you may at your option
728
     designate some or all of these sections as invariant.  To do this,
729
     add their titles to the list of Invariant Sections in the Modified
730
     Version's license notice.  These titles must be distinct from any
731
     other section titles.
732
 
733
     You may add a section Entitled "Endorsements", provided it contains
734
     nothing but endorsements of your Modified Version by various
735
     parties--for example, statements of peer review or that the text
736
     has been approved by an organization as the authoritative
737
     definition of a standard.
738
 
739
     You may add a passage of up to five words as a Front-Cover Text,
740
     and a passage of up to 25 words as a Back-Cover Text, to the end
741
     of the list of Cover Texts in the Modified Version.  Only one
742
     passage of Front-Cover Text and one of Back-Cover Text may be
743
     added by (or through arrangements made by) any one entity.  If the
744
     Document already includes a cover text for the same cover,
745
     previously added by you or by arrangement made by the same entity
746
     you are acting on behalf of, you may not add another; but you may
747
     replace the old one, on explicit permission from the previous
748
     publisher that added the old one.
749
 
750
     The author(s) and publisher(s) of the Document do not by this
751
     License give permission to use their names for publicity for or to
752
     assert or imply endorsement of any Modified Version.
753
 
754
  5. COMBINING DOCUMENTS
755
 
756
     You may combine the Document with other documents released under
757
     this License, under the terms defined in section 4 above for
758
     modified versions, provided that you include in the combination
759
     all of the Invariant Sections of all of the original documents,
760
     unmodified, and list them all as Invariant Sections of your
761
     combined work in its license notice, and that you preserve all
762
     their Warranty Disclaimers.
763
 
764
     The combined work need only contain one copy of this License, and
765
     multiple identical Invariant Sections may be replaced with a single
766
     copy.  If there are multiple Invariant Sections with the same name
767
     but different contents, make the title of each such section unique
768
     by adding at the end of it, in parentheses, the name of the
769
     original author or publisher of that section if known, or else a
770
     unique number.  Make the same adjustment to the section titles in
771
     the list of Invariant Sections in the license notice of the
772
     combined work.
773
 
774
     In the combination, you must combine any sections Entitled
775
     "History" in the various original documents, forming one section
776
     Entitled "History"; likewise combine any sections Entitled
777
     "Acknowledgements", and any sections Entitled "Dedications".  You
778
     must delete all sections Entitled "Endorsements."
779
 
780
  6. COLLECTIONS OF DOCUMENTS
781
 
782
     You may make a collection consisting of the Document and other
783
     documents released under this License, and replace the individual
784
     copies of this License in the various documents with a single copy
785
     that is included in the collection, provided that you follow the
786
     rules of this License for verbatim copying of each of the
787
     documents in all other respects.
788
 
789
     You may extract a single document from such a collection, and
790
     distribute it individually under this License, provided you insert
791
     a copy of this License into the extracted document, and follow
792
     this License in all other respects regarding verbatim copying of
793
     that document.
794
 
795
  7. AGGREGATION WITH INDEPENDENT WORKS
796
 
797
     A compilation of the Document or its derivatives with other
798
     separate and independent documents or works, in or on a volume of
799
     a storage or distribution medium, is called an "aggregate" if the
800
     copyright resulting from the compilation is not used to limit the
801
     legal rights of the compilation's users beyond what the individual
802
     works permit.  When the Document is included in an aggregate, this
803
     License does not apply to the other works in the aggregate which
804
     are not themselves derivative works of the Document.
805
 
806
     If the Cover Text requirement of section 3 is applicable to these
807
     copies of the Document, then if the Document is less than one half
808
     of the entire aggregate, the Document's Cover Texts may be placed
809
     on covers that bracket the Document within the aggregate, or the
810
     electronic equivalent of covers if the Document is in electronic
811
     form.  Otherwise they must appear on printed covers that bracket
812
     the whole aggregate.
813
 
814
  8. TRANSLATION
815
 
816
     Translation is considered a kind of modification, so you may
817
     distribute translations of the Document under the terms of section
818
     4.  Replacing Invariant Sections with translations requires special
819
     permission from their copyright holders, but you may include
820
     translations of some or all Invariant Sections in addition to the
821
     original versions of these Invariant Sections.  You may include a
822
     translation of this License, and all the license notices in the
823
     Document, and any Warranty Disclaimers, provided that you also
824
     include the original English version of this License and the
825
     original versions of those notices and disclaimers.  In case of a
826
     disagreement between the translation and the original version of
827
     this License or a notice or disclaimer, the original version will
828
     prevail.
829
 
830
     If a section in the Document is Entitled "Acknowledgements",
831
     "Dedications", or "History", the requirement (section 4) to
832
     Preserve its Title (section 1) will typically require changing the
833
     actual title.
834
 
835
  9. TERMINATION
836
 
837
     You may not copy, modify, sublicense, or distribute the Document
838
     except as expressly provided for under this License.  Any other
839
     attempt to copy, modify, sublicense or distribute the Document is
840
     void, and will automatically terminate your rights under this
841
     License.  However, parties who have received copies, or rights,
842
     from you under this License will not have their licenses
843
     terminated so long as such parties remain in full compliance.
844
 
845
 10. FUTURE REVISIONS OF THIS LICENSE
846
 
847
     The Free Software Foundation may publish new, revised versions of
848
     the GNU Free Documentation License from time to time.  Such new
849
     versions will be similar in spirit to the present version, but may
850
     differ in detail to address new problems or concerns.  See
851
     `http://www.gnu.org/copyleft/'.
852
 
853
     Each version of the License is given a distinguishing version
854
     number.  If the Document specifies that a particular numbered
855
     version of this License "or any later version" applies to it, you
856
     have the option of following the terms and conditions either of
857
     that specified version or of any later version that has been
858
     published (not as a draft) by the Free Software Foundation.  If
859
     the Document does not specify a version number of this License,
860
     you may choose any version ever published (not as a draft) by the
861
     Free Software Foundation.
862
 
863
ADDENDUM: How to use this License for your documents
864
====================================================
865
 
866
To use this License in a document you have written, include a copy of
867
the License in the document and put the following copyright and license
868
notices just after the title page:
869
 
870
       Copyright (C)  YEAR  YOUR NAME.
871
       Permission is granted to copy, distribute and/or modify this document
872
       under the terms of the GNU Free Documentation License, Version 1.2
873
       or any later version published by the Free Software Foundation;
874
       with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
875
       Texts.  A copy of the license is included in the section entitled ``GNU
876
       Free Documentation License''.
877
 
878
   If you have Invariant Sections, Front-Cover Texts and Back-Cover
879
Texts, replace the "with...Texts." line with this:
880
 
881
         with the Invariant Sections being LIST THEIR TITLES, with
882
         the Front-Cover Texts being LIST, and with the Back-Cover Texts
883
         being LIST.
884
 
885
   If you have Invariant Sections without Cover Texts, or some other
886
combination of the three, merge those two alternatives to suit the
887
situation.
888
 
889
   If your document contains nontrivial examples of program code, we
890
recommend releasing these examples in parallel under your choice of
891
free software license, such as the GNU General Public License, to
892
permit their use in free software.
893
 
894

895
File: gcj.info,  Node: Invoking gcj,  Next: Compatibility,  Prev: GNU Free Documentation License,  Up: Top
896
 
897
1 Invoking gcj
898
**************
899
 
900
As `gcj' is just another front end to `gcc', it supports many of the
901
same options as gcc.  *Note Option Summary: (gcc)Option Summary.  This
902
manual only documents the options specific to `gcj'.
903
 
904
* Menu:
905
 
906
* Input and output files::
907
* Input Options::               How gcj finds files
908
* Encodings::                   Options controlling source file encoding
909
* Warnings::                    Options controlling warnings specific to gcj
910
* Linking::                     Options for making an executable
911
* Code Generation::             Options controlling the output of gcj
912
* Configure-time Options::      Options you won't use
913
 
914

915
File: gcj.info,  Node: Input and output files,  Next: Input Options,  Up: Invoking gcj
916
 
917
1.1 Input and output files
918
==========================
919
 
920
A `gcj' command is like a `gcc' command, in that it consists of a
921
number of options and file names.  The following kinds of input file
922
names are supported:
923
 
924
`FILE.java'
925
     Java source files.
926
 
927
`FILE.class'
928
     Java bytecode files.
929
 
930
`FILE.zip'
931
`FILE.jar'
932
     An archive containing one or more `.class' files, all of which are
933
     compiled.  The archive may be compressed.  Files in an archive
934
     which don't end with `.class' are treated as resource files; they
935
     are compiled into the resulting object file as `core:' URLs.
936
 
937
`@FILE'
938
     A file containing a whitespace-separated list of input file names.
939
     (Currently, these must all be `.java' source files, but that may
940
     change.)  Each named file is compiled, just as if it had been on
941
     the command line.
942
 
943
`LIBRARY.a'
944
`LIBRARY.so'
945
`-lLIBNAME'
946
     Libraries to use when linking.  See the `gcc' manual.
947
 
948
   You can specify more than one input file on the `gcj' command line,
949
in which case they will all be compiled.  If you specify a `-o FILENAME'
950
option, all the input files will be compiled together, producing a
951
single output file, named FILENAME.  This is allowed even when using
952
`-S' or `-c', but not when using `-C' or `--resource'.  (This is an
953
extension beyond the what plain `gcc' allows.)  (If more than one input
954
file is specified, all must currently be `.java' files, though we hope
955
to fix this.)
956
 
957

958
File: gcj.info,  Node: Input Options,  Next: Encodings,  Prev: Input and output files,  Up: Invoking gcj
959
 
960
1.2 Input Options
961
=================
962
 
963
`gcj' has options to control where it looks to find files it needs.
964
For instance, `gcj' might need to load a class that is referenced by
965
the file it has been asked to compile.  Like other compilers for the
966
Java language, `gcj' has a notion of a "class path".  There are several
967
options and environment variables which can be used to manipulate the
968
class path.  When `gcj' looks for a given class, it searches the class
969
path looking for matching `.class' or `.java' file.  `gcj' comes with a
970
built-in class path which points at the installed `libgcj.jar', a file
971
which contains all the standard classes.
972
 
973
   In the below, a directory or path component can refer either to an
974
actual directory on the filesystem, or to a `.zip' or `.jar' file,
975
which `gcj' will search as if it is a directory.
976
 
977
`-IDIR'
978
     All directories specified by `-I' are kept in order and prepended
979
     to the class path constructed from all the other options.  Unless
980
     compatibility with tools like `javac' is important, we recommend
981
     always using `-I' instead of the other options for manipulating the
982
     class path.
983
 
984
`--classpath=PATH'
985
     This sets the class path to PATH, a colon-separated list of paths
986
     (on Windows-based systems, a semicolon-separate list of paths).
987
     This does not override the builtin ("boot") search path.
988
 
989
`--CLASSPATH=PATH'
990
     Deprecated synonym for `--classpath'.
991
 
992
`--bootclasspath=PATH'
993
     Where to find the standard builtin classes, such as
994
     `java.lang.String'.
995
 
996
`--extdirs=PATH'
997
     For each directory in the PATH, place the contents of that
998
     directory at the end of the class path.
999
 
1000
`CLASSPATH'
1001
     This is an environment variable which holds a list of paths.
1002
 
1003
   The final class path is constructed like so:
1004
 
1005
   * First come all directories specified via `-I'.
1006
 
1007
   * If `--classpath' is specified, its value is appended.  Otherwise,
1008
     if the `CLASSPATH' environment variable is specified, then its
1009
     value is appended.  Otherwise, the current directory (`"."') is
1010
     appended.
1011
 
1012
   * If `--bootclasspath' was specified, append its value.  Otherwise,
1013
     append the built-in system directory, `libgcj.jar'.
1014
 
1015
   * Finally, if `--extdirs' was specified, append the contents of the
1016
     specified directories at the end of the class path.  Otherwise,
1017
     append the contents of the built-in extdirs at
1018
     `$(prefix)/share/java/ext'.
1019
 
1020
   The classfile built by `gcj' for the class `java.lang.Object' (and
1021
placed in `libgcj.jar') contains a special zero length attribute
1022
`gnu.gcj.gcj-compiled'. The compiler looks for this attribute when
1023
loading `java.lang.Object' and will report an error if it isn't found,
1024
unless it compiles to bytecode (the option
1025
`-fforce-classes-archive-check' can be used to override this behavior
1026
in this particular case.)
1027
 
1028
`-fforce-classes-archive-check'
1029
     This forces the compiler to always check for the special zero
1030
     length attribute `gnu.gcj.gcj-compiled' in `java.lang.Object' and
1031
     issue an error if it isn't found.
1032
 
1033

1034
File: gcj.info,  Node: Encodings,  Next: Warnings,  Prev: Input Options,  Up: Invoking gcj
1035
 
1036
1.3 Encodings
1037
=============
1038
 
1039
The Java programming language uses Unicode throughout.  In an effort to
1040
integrate well with other locales, `gcj' allows `.java' files to be
1041
written using almost any encoding.  `gcj' knows how to convert these
1042
encodings into its internal encoding at compile time.
1043
 
1044
   You can use the `--encoding=NAME' option to specify an encoding (of
1045
a particular character set) to use for source files.  If this is not
1046
specified, the default encoding comes from your current locale.  If
1047
your host system has insufficient locale support, then `gcj' assumes
1048
the default encoding to be the `UTF-8' encoding of Unicode.
1049
 
1050
   To implement `--encoding', `gcj' simply uses the host platform's
1051
`iconv' conversion routine.  This means that in practice `gcj' is
1052
limited by the capabilities of the host platform.
1053
 
1054
   The names allowed for the argument `--encoding' vary from platform
1055
to platform (since they are not standardized anywhere).  However, `gcj'
1056
implements the encoding named `UTF-8' internally, so if you choose to
1057
use this for your source files you can be assured that it will work on
1058
every host.
1059
 
1060

1061
File: gcj.info,  Node: Warnings,  Next: Linking,  Prev: Encodings,  Up: Invoking gcj
1062
 
1063
1.4 Warnings
1064
============
1065
 
1066
`gcj' implements several warnings.  As with other generic `gcc'
1067
warnings, if an option of the form `-Wfoo' enables a warning, then
1068
`-Wno-foo' will disable it.  Here we've chosen to document the form of
1069
the warning which will have an effect - the default being the opposite
1070
of what is listed.
1071
 
1072
`-Wredundant-modifiers'
1073
     With this flag, `gcj' will warn about redundant modifiers.  For
1074
     instance, it will warn if an interface method is declared `public'.
1075
 
1076
`-Wextraneous-semicolon'
1077
     This causes `gcj' to warn about empty statements.  Empty statements
1078
     have been deprecated.
1079
 
1080
`-Wno-out-of-date'
1081
     This option will cause `gcj' not to warn when a source file is
1082
     newer than its matching class file.  By default `gcj' will warn
1083
     about this.
1084
 
1085
`-Wno-deprecated'
1086
     Warn if a deprecated class, method, or field is referred to.
1087
 
1088
`-Wunused'
1089
     This is the same as `gcc''s `-Wunused'.
1090
 
1091
`-Wall'
1092
     This is the same as `-Wredundant-modifiers -Wextraneous-semicolon
1093
     -Wunused'.
1094
 
1095

1096
File: gcj.info,  Node: Linking,  Next: Code Generation,  Prev: Warnings,  Up: Invoking gcj
1097
 
1098
1.5 Linking
1099
===========
1100
 
1101
To turn a Java application into an executable program, you need to link
1102
it with the needed libraries, just as for C or C++.  The linker by
1103
default looks for a global function named `main'.  Since Java does not
1104
have global functions, and a collection of Java classes may have more
1105
than one class with a `main' method, you need to let the linker know
1106
which of those `main' methods it should invoke when starting the
1107
application.  You can do that in any of these ways:
1108
 
1109
   * Specify the class containing the desired `main' method when you
1110
     link the application, using the `--main' flag, described below.
1111
 
1112
   * Link the Java package(s) into a shared library (dll) rather than an
1113
     executable.  Then invoke the application using the `gij' program,
1114
     making sure that `gij' can find the libraries it needs.
1115
 
1116
   * Link the Java packages(s) with the flag `-lgij', which links in
1117
     the `main' routine from the `gij' command.  This allows you to
1118
     select the class whose `main' method you want to run when you run
1119
     the application.  You can also use other `gij' flags, such as `-D'
1120
     flags to set properties.  Using the `-lgij' library (rather than
1121
     the `gij' program of the previous mechanism) has some advantages:
1122
     it is compatible with static linking, and does not require
1123
     configuring or installing libraries.
1124
 
1125
   These `gij' options relate to linking an executable:
1126
 
1127
`--main=CLASSNAME'
1128
     This option is used when linking to specify the name of the class
1129
     whose `main' method should be invoked when the resulting
1130
     executable is run.
1131
 
1132
`-DNAME[=VALUE]'
1133
     This option can only be used with `--main'.  It defines a system
1134
     property named NAME with value VALUE.  If VALUE is not specified
1135
     then it defaults to the empty string.  These system properties are
1136
     initialized at the program's startup and can be retrieved at
1137
     runtime using the `java.lang.System.getProperty' method.
1138
 
1139
`-lgij'
1140
     Create an application whose command-line processing is that of the
1141
     `gij' command.
1142
 
1143
     This option is an alternative to using `--main'; you cannot use
1144
     both.
1145
 
1146

1147
File: gcj.info,  Node: Code Generation,  Next: Configure-time Options,  Prev: Linking,  Up: Invoking gcj
1148
 
1149
1.6 Code Generation
1150
===================
1151
 
1152
In addition to the many `gcc' options controlling code generation,
1153
`gcj' has several options specific to itself.
1154
 
1155
`-C'
1156
     This option is used to tell `gcj' to generate bytecode (`.class'
1157
     files) rather than object code.
1158
 
1159
`--resource RESOURCE-NAME'
1160
     This option is used to tell `gcj' to compile the contents of a
1161
     given file to object code so it may be accessed at runtime with
1162
     the core protocol handler as `core:/RESOURCE-NAME'.  Note that
1163
     RESOURCE-NAME is the name of the resource as found at runtime; for
1164
     instance, it could be used in a call to `ResourceBundle.getBundle'.
1165
     The actual file name to be compiled this way must be specified
1166
     separately.
1167
 
1168
`-d DIRECTORY'
1169
     When used with `-C', this causes all generated `.class' files to
1170
     be put in the appropriate subdirectory of DIRECTORY.  By default
1171
     they will be put in subdirectories of the current working
1172
     directory.
1173
 
1174
`-fno-bounds-check'
1175
     By default, `gcj' generates code which checks the bounds of all
1176
     array indexing operations.  With this option, these checks are
1177
     omitted, which can improve performance for code that uses arrays
1178
     extensively.  Note that this can result in unpredictable behavior
1179
     if the code in question actually does violate array bounds
1180
     constraints.  It is safe to use this option if you are sure that
1181
     your code will never throw an `ArrayIndexOutOfBoundsException'.
1182
 
1183
`-fno-store-check'
1184
     Don't generate array store checks.  When storing objects into
1185
     arrays, a runtime check is normally generated in order to ensure
1186
     that the object is assignment compatible with the component type
1187
     of the array (which may not be known at compile-time).  With this
1188
     option, these checks are omitted.  This can improve performance
1189
     for code which stores objects into arrays frequently.  It is safe
1190
     to use this option if you are sure your code will never throw an
1191
     `ArrayStoreException'.
1192
 
1193
`-fjni'
1194
     With `gcj' there are two options for writing native methods: CNI
1195
     and JNI.  By default `gcj' assumes you are using CNI.  If you are
1196
     compiling a class with native methods, and these methods are
1197
     implemented using JNI, then you must use `-fjni'.  This option
1198
     causes `gcj' to generate stubs which will invoke the underlying JNI
1199
     methods.
1200
 
1201
`-fno-assert'
1202
     Don't recognize the `assert' keyword.  This is for compatibility
1203
     with older versions of the language specification.
1204
 
1205
`-fno-optimize-static-class-initialization'
1206
     When the optimization level is greater or equal to `-O2', `gcj'
1207
     will try to optimize the way calls into the runtime are made to
1208
     initialize static classes upon their first use (this optimization
1209
     isn't carried out if `-C' was specified.) When compiling to native
1210
     code, `-fno-optimize-static-class-initialization' will turn this
1211
     optimization off, regardless of the optimization level in use.
1212
 
1213
`--disable-assertions[=CLASS-OR-PACKAGE]'
1214
     Don't include code for checking assertions in the compiled code.
1215
     If `=CLASS-OR-PACKAGE' is missing disables assertion code
1216
     generation for all classes, unless overridden by a more specific
1217
     `--enable-assertions' flag.  If CLASS-OR-PACKAGE is a class name,
1218
     only disables generating assertion checks within the named class
1219
     or its inner classes.  If CLASS-OR-PACKAGE is a package name,
1220
     disables generating assertion checks within the named package or a
1221
     subpackage.
1222
 
1223
     By default, assertions are enabled when generating class files or
1224
     when not optimizing, and disabled when generating optimized
1225
     binaries.
1226
 
1227
`--enable-assertions[=CLASS-OR-PACKAGE]'
1228
     Generates code to check assertions.  The option is perhaps
1229
     misnamed, as you still need to turn on assertion checking at
1230
     run-time, and we don't support any easy way to do that.  So this
1231
     flag isn't very useful yet, except to partially override
1232
     `--disable-assertions'.
1233
 
1234
`-findirect-dispatch'
1235
     `gcj' has a special binary compatibility ABI, which is enabled by
1236
     the `-findirect-dispatch' option.  In this mode, the code
1237
     generated by `gcj' honors the binary compatibility guarantees in
1238
     the Java Language Specification, and the resulting object files do
1239
     not need to be directly linked against their dependencies.
1240
     Instead, all dependencies are looked up at runtime.  This allows
1241
     free mixing of interpreted and compiled code.
1242
 
1243
     Note that, at present, `-findirect-dispatch' can only be used when
1244
     compiling `.class' files.  It will not work when compiling from
1245
     source.  CNI also does not yet work with the binary compatibility
1246
     ABI.  These restrictions will be lifted in some future release.
1247
 
1248
     However, if you compile CNI code with the standard ABI, you can
1249
     call it from code built with the binary compatibility ABI.
1250
 
1251
`-fbootstrap-classes'
1252
     This option can be use to tell `libgcj' that the compiled classes
1253
     should be loaded by the bootstrap loader, not the system class
1254
     loader.  By default, if you compile a class and link it into an
1255
     executable, it will be treated as if it was loaded using the
1256
     system class loader.  This is convenient, as it means that things
1257
     like `Class.forName()' will search `CLASSPATH' to find the desired
1258
     class.
1259
 
1260
 
1261

1262
File: gcj.info,  Node: Configure-time Options,  Prev: Code Generation,  Up: Invoking gcj
1263
 
1264
1.7 Configure-time Options
1265
==========================
1266
 
1267
Some `gcj' code generations options affect the resulting ABI, and so
1268
can only be meaningfully given when `libgcj', the runtime package, is
1269
configured.  `libgcj' puts the appropriate options from this group into
1270
a `spec' file which is read by `gcj'.  These options are listed here
1271
for completeness; if you are using `libgcj' then you won't want to
1272
touch these options.
1273
 
1274
`-fuse-boehm-gc'
1275
     This enables the use of the Boehm GC bitmap marking code.  In
1276
     particular this causes `gcj' to put an object marking descriptor
1277
     into each vtable.
1278
 
1279
`-fhash-synchronization'
1280
     By default, synchronization data (the data used for `synchronize',
1281
     `wait', and `notify') is pointed to by a word in each object.
1282
     With this option `gcj' assumes that this information is stored in a
1283
     hash table and not in the object itself.
1284
 
1285
`-fuse-divide-subroutine'
1286
     On some systems, a library routine is called to perform integer
1287
     division.  This is required to get exception handling correct when
1288
     dividing by zero.
1289
 
1290
`-fcheck-references'
1291
     On some systems it's necessary to insert inline checks whenever
1292
     accessing an object via a reference.  On other systems you won't
1293
     need this because null pointer accesses are caught automatically
1294
     by the processor.
1295
 
1296

1297
File: gcj.info,  Node: Compatibility,  Next: Invoking gcjh,  Prev: Invoking gcj,  Up: Top
1298
 
1299
2 Compatibility with the Java Platform
1300
**************************************
1301
 
1302
As we believe it is important that the Java platform not be fragmented,
1303
`gcj' and `libgcj' try to conform to the relevant Java specifications.
1304
However, limited manpower and incomplete and unclear documentation work
1305
against us.  So, there are caveats to using `gcj'.
1306
 
1307
* Menu:
1308
 
1309
* Limitations::
1310
* Extensions::
1311
 
1312

1313
File: gcj.info,  Node: Limitations,  Next: Extensions,  Up: Compatibility
1314
 
1315
2.1 Standard features not yet supported
1316
=======================================
1317
 
1318
This list of compatibility issues is by no means complete.
1319
 
1320
   * `gcj' implements the JDK 1.2 language.  It supports inner classes
1321
     and the new 1.4 `assert' keyword.  It does not yet support the
1322
     Java 2 `strictfp' keyword (it recognizes the keyword but ignores
1323
     it).
1324
 
1325
   * `libgcj' is largely compatible with the JDK 1.2 libraries.
1326
     However, `libgcj' is missing many packages, most notably
1327
     `java.awt'.  There are also individual missing classes and methods.
1328
     We currently do not have a list showing differences between
1329
     `libgcj' and the Java 2 platform.
1330
 
1331
   * Sometimes the `libgcj' implementation of a method or class differs
1332
     from the JDK implementation.  This is not always a bug.  Still, if
1333
     it affects you, it probably makes sense to report it so that we
1334
     can discuss the appropriate response.
1335
 
1336
   * `gcj' does not currently allow for piecemeal replacement of
1337
     components within `libgcj'. Unfortunately, programmers often want
1338
     to use newer versions of certain packages, such as those provided
1339
     by the Apache Software Foundation's Jakarta project.  This has
1340
     forced us to place the `org.w3c.dom' and `org.xml.sax' packages
1341
     into their own libraries, separate from `libgcj'.  If you intend to
1342
     use these classes, you must link them explicitly with
1343
     `-l-org-w3c-dom' and `-l-org-xml-sax'.  Future versions of `gcj'
1344
     may not have this restriction.
1345
 
1346

1347
File: gcj.info,  Node: Extensions,  Prev: Limitations,  Up: Compatibility
1348
 
1349
2.2 Extra features unique to gcj
1350
================================
1351
 
1352
The main feature of `gcj' is that it can compile programs written in
1353
the Java programming language to native code.  Most extensions that
1354
have been added are to facilitate this functionality.
1355
 
1356
   * `gcj' makes it easy and efficient to mix code written in Java and
1357
     C++.  *Note About CNI::, for more info on how to use this in your
1358
     programs.
1359
 
1360
   * When you compile your classes into a shared library they can be
1361
     automatically loaded by the `libgcj' system classloader.  When
1362
     trying to load a class `gnu.pkg.SomeClass' the system classloader
1363
     will first try to load the shared library
1364
     `lib-gnu-pkg-SomeClass.so', if that fails to load the class then
1365
     it will try to load `lib-gnu-pkg.so' and finally when the class is
1366
     still not loaded it will try to load `lib-gnu.so'.  Note that all
1367
     `.'s will be transformed into `-'s and that searching for inner
1368
     classes starts with their outermost outer class.  If the class
1369
     cannot be found this way the system classloader tries to use the
1370
     `libgcj' bytecode interpreter to load the class from the standard
1371
     classpath.  This process can be controlled to some degree via the
1372
     `gnu.gcj.runtime.VMClassLoader.library_control' property; *Note
1373
     libgcj Runtime Properties::.
1374
 
1375
   * `libgcj' includes a special `gcjlib' URL type.  A URL of this form
1376
     is like a `jar' URL, and looks like
1377
     `gcjlib:/path/to/shared/library.so!/path/to/resource'.  An access
1378
     to one of these URLs causes the shared library to be `dlopen()'d,
1379
     and then the resource is looked for in that library.  These URLs
1380
     are most useful when used in conjunction with
1381
     `java.net.URLClassLoader'.  Note that, due to implementation
1382
     limitations, currently any such URL can be accessed by only one
1383
     class loader, and libraries are never unloaded.  This means some
1384
     care must be exercised to make sure that a `gcjlib' URL is not
1385
     accessed by more than one class loader at once.  In a future
1386
     release this limitation will be lifted, and such libraries will be
1387
     mapped privately.
1388
 
1389
   * A program compiled by `gcj' will examine the `GCJ_PROPERTIES'
1390
     environment variable and change its behavior in some ways.  In
1391
     particular `GCJ_PROPERTIES' holds a list of assignments to global
1392
     properties, such as would be set with the `-D' option to `java'.
1393
     For instance, `java.compiler=gcj' is a valid (but currently
1394
     meaningless) setting.
1395
 
1396
 
1397

1398
File: gcj.info,  Node: Invoking gcjh,  Next: Invoking gjnih,  Prev: Compatibility,  Up: Top
1399
 
1400
3 Invoking gcjh
1401
***************
1402
 
1403
The `gcjh' program is used to generate header files from class files.
1404
It can generate both CNI and JNI header files, as well as stub
1405
implementation files which can be used as a basis for implementing the
1406
required native methods.
1407
 
1408
`-stubs'
1409
     This causes `gcjh' to generate stub files instead of header files.
1410
     By default the stub file will be named after the class, with a
1411
     suffix of `.cc'.  In JNI mode, the default output file will have
1412
     the suffix `.c'.
1413
 
1414
`-jni'
1415
     This tells `gcjh' to generate a JNI header or stub.  By default,
1416
     CNI headers are generated.
1417
 
1418
`-force'
1419
     This option forces `gcjh' to write the output file.
1420
 
1421
`-old'
1422
     This option is accepted but ignored for compatibility.
1423
 
1424
`-trace'
1425
     This option is accepted but ignored for compatibility.
1426
 
1427
`-J OPTION'
1428
     This option is accepted but ignored for compatibility.
1429
 
1430
`-add TEXT'
1431
     Inserts TEXT into the class body.  This is ignored in JNI mode.
1432
 
1433
`-append TEXT'
1434
     Inserts TEXT into the header file after the class declaration.
1435
     This is ignored in JNI mode.
1436
 
1437
`-friend TEXT'
1438
     Inserts TEXT into the class as a `friend' declaration.  This is
1439
     ignored in JNI mode.
1440
 
1441
`-prepend TEXT'
1442
     Inserts TEXT into the header file before the class declaration.
1443
     This is ignored in JNI mode.
1444
 
1445
`--classpath=PATH'
1446
`--CLASSPATH=PATH'
1447
`--bootclasspath=PATH'
1448
`-IDIRECTORY'
1449
`-d DIRECTORY'
1450
`-o FILE'
1451
     These options are all identical to the corresponding `gcj' options.
1452
 
1453
`-o FILE'
1454
     Sets the output file name.  This cannot be used if there is more
1455
     than one class on the command line.
1456
 
1457
`-td DIRECTORY'
1458
     Sets the name of the directory to use for temporary files.
1459
 
1460
`-M'
1461
     Print all dependencies to stdout; suppress ordinary output.
1462
 
1463
`-MM'
1464
     Print non-system dependencies to stdout; suppress ordinary output.
1465
 
1466
`-MD'
1467
     Print all dependencies to stdout.
1468
 
1469
`-MMD'
1470
     Print non-system dependencies to stdout.
1471
 
1472
`--help'
1473
     Print help about `gcjh' and exit.  No further processing is done.
1474
 
1475
`--version'
1476
     Print version information for `gcjh' and exit.  No further
1477
     processing is done.
1478
 
1479
`-v, --verbose'
1480
     Print extra information while running.
1481
 
1482
   All remaining options are considered to be names of classes.
1483
 
1484

1485
File: gcj.info,  Node: Invoking gjnih,  Next: Invoking jv-scan,  Prev: Invoking gcjh,  Up: Top
1486
 
1487
4 Invoking gjnih
1488
****************
1489
 
1490
The `gjnih' program is used to generate JNI header files from class
1491
files.  Running it is equivalent to running `gcjh -jni'.
1492
 
1493
`-stubs'
1494
     This causes `gjnih' to generate stub files instead of header files.
1495
     By default the stub file will be named after the class, with a
1496
     suffix of `.c'.
1497
 
1498
`-jni'
1499
     This option specifies the default behavior which is to generate a
1500
     JNI header or stub.
1501
 
1502
`-force'
1503
     This option forces `gjnih' to write the output file.
1504
 
1505
`-old'
1506
     This option is accepted but ignored for compatibility.
1507
 
1508
`-trace'
1509
     This option is accepted but ignored for compatibility.
1510
 
1511
`-J OPTION'
1512
     This option is accepted but ignored for compatibility.
1513
 
1514
`-add TEXT'
1515
     Inserts TEXT into the class body.  This is ignored in by `gjnih'.
1516
 
1517
`-append TEXT'
1518
     Inserts TEXT into the header file after the class declaration.
1519
     This is ignored in by `gjnih'.
1520
 
1521
`-friend TEXT'
1522
     Inserts TEXT into the class as a `friend' declaration.  This is
1523
     ignored by `gjnih'.
1524
 
1525
`-prepend TEXT'
1526
     Inserts TEXT into the header file before the class declaration.
1527
     This is ignored in by `gjnih'.
1528
 
1529
`--classpath=PATH'
1530
`--CLASSPATH=PATH'
1531
`--bootclasspath=PATH'
1532
`-IDIRECTORY'
1533
`-d DIRECTORY'
1534
`-o FILE'
1535
     These options are all identical to the corresponding `gcj' options.
1536
 
1537
`-o FILE'
1538
     Sets the output file name.  This cannot be used if there is more
1539
     than one class on the command line.
1540
 
1541
`-td DIRECTORY'
1542
     Sets the name of the directory to use for temporary files.
1543
 
1544
`-M'
1545
     Print all dependencies to stdout; suppress ordinary output.
1546
 
1547
`-MM'
1548
     Print non-system dependencies to stdout; suppress ordinary output.
1549
 
1550
`-MD'
1551
     Print all dependencies to stdout.
1552
 
1553
`-MMD'
1554
     Print non-system dependencies to stdout.
1555
 
1556
`--help'
1557
     Print help about `gjnih' and exit.  No further processing is done.
1558
 
1559
`--version'
1560
     Print version information for `gjnih' and exit.  No further
1561
     processing is done.
1562
 
1563
`-v, --verbose'
1564
     Print extra information while running.
1565
 
1566
   All remaining options are considered to be names of classes.
1567
 
1568

1569
File: gcj.info,  Node: Invoking jv-scan,  Next: Invoking jcf-dump,  Prev: Invoking gjnih,  Up: Top
1570
 
1571
5 Invoking jv-scan
1572
******************
1573
 
1574
The `jv-scan' program can be used to print information about a Java
1575
source file (`.java' file).
1576
 
1577
`--no-assert'
1578
     Don't recognize the `assert' keyword, for backwards compatibility
1579
     with older versions of the language specification.
1580
 
1581
`--complexity'
1582
     This prints a complexity measure, related to cyclomatic
1583
     complexity, for each input file.
1584
 
1585
`--encoding=NAME'
1586
     This works like the corresponding `gcj' option.
1587
 
1588
`--print-main'
1589
     This prints the name of the class in this file containing a `main'
1590
     method.
1591
 
1592
`--list-class'
1593
     This lists the names of all classes defined in the input files.
1594
 
1595
`--list-filename'
1596
     If `--list-class' is given, this option causes `jv-scan' to also
1597
     print the name of the file in which each class was found.
1598
 
1599
`-o FILE'
1600
     Print output to the named file.
1601
 
1602
`--help'
1603
     Print help, then exit.
1604
 
1605
`--version'
1606
     Print version number, then exit.
1607
 
1608

1609
File: gcj.info,  Node: Invoking jcf-dump,  Next: Invoking gij,  Prev: Invoking jv-scan,  Up: Top
1610
 
1611
6 Invoking jcf-dump
1612
*******************
1613
 
1614
This is a class file examiner, similar to `javap'.  It will print
1615
information about a number of classes, which are specified by class name
1616
or file name.
1617
 
1618
`-c'
1619
     Disassemble method bodies.  By default method bodies are not
1620
     printed.
1621
 
1622
`--print-constants'
1623
     Print the constant pool.  When printing a reference to a constant
1624
     also print its index in the constant pool.
1625
 
1626
`--javap'
1627
     Generate output in `javap' format.  The implementation of this
1628
     feature is very incomplete.
1629
 
1630
`--classpath=PATH'
1631
`--CLASSPATH=PATH'
1632
`-IDIRECTORY'
1633
`-o FILE'
1634
     These options as the same as the corresponding `gcj' options.
1635
 
1636
`--help'
1637
     Print help, then exit.
1638
 
1639
`--version'
1640
     Print version number, then exit.
1641
 
1642
`-v, --verbose'
1643
     Print extra information while running.  Implies
1644
     `--print-constants'.
1645
 
1646

1647
File: gcj.info,  Node: Invoking gij,  Next: Invoking gcj-dbtool,  Prev: Invoking jcf-dump,  Up: Top
1648
 
1649
7 Invoking gij
1650
**************
1651
 
1652
`gij' is a Java bytecode interpreter included with `libgcj'.  `gij' is
1653
not available on every platform; porting it requires a small amount of
1654
assembly programming which has not been done for all the targets
1655
supported by `gcj'.
1656
 
1657
   The primary argument to `gij' is the name of a class or, with
1658
`-jar', a jar file.  Options before this argument are interpreted by
1659
`gij'; remaining options are passed to the interpreted program.
1660
 
1661
   If a class name is specified and this class does not have a `main'
1662
method with the appropriate signature (a `static void' method with a
1663
`String[]' as its sole argument), then `gij' will print an error and
1664
exit.
1665
 
1666
   If a jar file is specified then `gij' will use information in it to
1667
determine which class' `main' method will be invoked.
1668
 
1669
   `gij' will invoke the `main' method with all the remaining
1670
command-line options.
1671
 
1672
   Note that `gij' is not limited to interpreting code.  Because
1673
`libgcj' includes a class loader which can dynamically load shared
1674
objects, it is possible to give `gij' the name of a class which has
1675
been compiled and put into a shared library on the class path.
1676
 
1677
`-cp PATH'
1678
`-classpath PATH'
1679
     Set the initial class path.  The class path is used for finding
1680
     class and resource files.  If specified, this option overrides the
1681
     `CLASSPATH' environment variable.  Note that this option is
1682
     ignored if `-jar' is used.
1683
 
1684
`-DNAME[=VALUE]'
1685
     This defines a system property named NAME with value VALUE.  If
1686
     VALUE is not specified then it defaults to the empty string.
1687
     These system properties are initialized at the program's startup
1688
     and can be retrieved at runtime using the
1689
     `java.lang.System.getProperty' method.
1690
 
1691
`-ms=NUMBER'
1692
     Equivalent to `-Xms'.
1693
 
1694
`-mx=NUMBER'
1695
     Equivalent to `-Xmx'.
1696
 
1697
`-noverify'
1698
     Do not verify compliance of bytecode with the VM specification. In
1699
     addition, this option disables type verification which is
1700
     otherwise performed on BC-ABI compiled code.
1701
 
1702
`-X'
1703
`-XARGUMENT'
1704
     Supplying `-X' by itself will cause `gij' to list all the
1705
     supported `-X' options.  Currently these options are supported:
1706
 
1707
    `-XmsSIZE'
1708
          Set the initial heap size.
1709
 
1710
    `-XmxSIZE'
1711
          Set the maximum heap size.
1712
 
1713
    `-XssSIZE'
1714
          Set the thread stack size.
1715
 
1716
     Unrecognized `-X' options are ignored, for compatibility with
1717
     other runtimes.
1718
 
1719
`-jar'
1720
     This indicates that the name passed to `gij' should be interpreted
1721
     as the name of a jar file, not a class.
1722
 
1723
`--help'
1724
`-?'
1725
     Print help, then exit.
1726
 
1727
`--showversion'
1728
     Print version number and continue.
1729
 
1730
`--fullversion'
1731
     Print detailed version information, then exit.
1732
 
1733
`--version'
1734
     Print version number, then exit.
1735
 
1736
`-verbose'
1737
`-verbose:class'
1738
     Each time a class is initialized, print a short message on
1739
     standard error.
1740
 
1741
   `gij' also recognizes and ignores the following options, for
1742
compatibility with existing application launch scripts: `-client',
1743
`-server', `-hotspot', `-jrockit', `-agentlib', `-agentpath', `-debug',
1744
`-d32', `-d64', `-javaagent', `-noclassgc', `-verify', and
1745
`-verifyremote'.
1746
 
1747

1748
File: gcj.info,  Node: Invoking gcj-dbtool,  Next: Invoking jv-convert,  Prev: Invoking gij,  Up: Top
1749
 
1750
8 Invoking gcj-dbtool.
1751
**********************
1752
 
1753
`gcj-dbtool' is a tool for creating and manipulating class file mapping
1754
databases.  `libgcj' can use these databases to find a shared library
1755
corresponding to the bytecode representation of a class.  This
1756
functionality is useful for ahead-of-time compilation of a program that
1757
has no knowledge of `gcj'.
1758
 
1759
   `gcj-dbtool' works best if all the jar files added to it are
1760
compiled using `-findirect-dispatch'.
1761
 
1762
   Note that `gcj-dbtool' is currently available as "preview
1763
technology".  We believe it is a reasonable way to allow
1764
application-transparent ahead-of-time compilation, but this is an
1765
unexplored area.  We welcome your comments.
1766
 
1767
`-n DBFILE [SIZE]'
1768
     This creates a new database.  Currently, databases cannot be
1769
     resized; you can choose a larger initial size if desired.  The
1770
     default size is 32,749.
1771
 
1772
`-a DBFILE JARFILE LIB'
1773
`-f DBFILE JARFILE LIB'
1774
     This adds a jar file to the database.  For each class file in the
1775
     jar, a cryptographic signature of the bytecode representation of
1776
     the class is recorded in the database.  At runtime, a class is
1777
     looked up by its signature and the compiled form of the class is
1778
     looked for in the corresponding shared library.  The `-a' option
1779
     will verify that LIB exists before adding it to the database; `-f'
1780
     skips this check.
1781
 
1782
`[`-'][`-0'] -m DBFILE DBFILE,[DBFILE]'
1783
     Merge a number of databases.  The output database overwrites any
1784
     existing database.  To add databases into an existing database,
1785
     include the destination in the list of sources.
1786
 
1787
     If `-' or `-0' are used, the list of files to read is taken from
1788
     standard input instead of the command line.  For `-0', Input
1789
     filenames are terminated by a null character instead of by
1790
     whitespace.  Useful when arguments might contain white space.  The
1791
     GNU find -print0 option produces input suitable for this mode.
1792
 
1793
`-t DBFILE'
1794
     Test a database.
1795
 
1796
`-l DBFILE'
1797
     List the contents of a database.
1798
 
1799
`-p'
1800
     Print the name of the default database.  If there is no default
1801
     database, this prints a blank line.  If LIBDIR is specified, use
1802
     it instead of the default library directory component of the
1803
     database name.
1804
 
1805
`--help'
1806
     Print a help message, then exit.
1807
 
1808
`--version'
1809
`-v'
1810
     Print version information, then exit.
1811
 
1812
 
1813

1814
File: gcj.info,  Node: Invoking jv-convert,  Next: Invoking grmic,  Prev: Invoking gcj-dbtool,  Up: Top
1815
 
1816
9 Invoking jv-convert
1817
*********************
1818
 
1819
`jv-convert' [`OPTION'] ... [INPUTFILE [OUTPUTFILE]]
1820
 
1821
   `jv-convert' is a utility included with `libgcj' which converts a
1822
file from one encoding to another.  It is similar to the Unix `iconv'
1823
utility.
1824
 
1825
   The encodings supported by `jv-convert' are platform-dependent.
1826
Currently there is no way to get a list of all supported encodings.
1827
 
1828
`--encoding NAME'
1829
`--from NAME'
1830
     Use NAME as the input encoding.  The default is the current
1831
     locale's encoding.
1832
 
1833
`--to NAME'
1834
     Use NAME as the output encoding.  The default is the `JavaSrc'
1835
     encoding; this is ASCII with `\u' escapes for non-ASCII characters.
1836
 
1837
`-i FILE'
1838
     Read from FILE.  The default is to read from standard input.
1839
 
1840
`-o FILE'
1841
     Write to FILE.  The default is to write to standard output.
1842
 
1843
`--reverse'
1844
     Swap the input and output encodings.
1845
 
1846
`--help'
1847
     Print a help message, then exit.
1848
 
1849
`--version'
1850
     Print version information, then exit.
1851
 
1852

1853
File: gcj.info,  Node: Invoking grmic,  Next: Invoking grmiregistry,  Prev: Invoking jv-convert,  Up: Top
1854
 
1855
10 Invoking grmic
1856
*****************
1857
 
1858
`grmic' [`OPTION'] ... CLASS ...
1859
 
1860
   `grmic' is a utility included with `libgcj' which generates stubs
1861
for remote objects.
1862
 
1863
   Note that this program isn't yet fully compatible with the JDK
1864
`grmic'.  Some options, such as `-classpath', are recognized but
1865
currently ignored.  We have left these options undocumented for now.
1866
 
1867
   Long options can also be given with a GNU-style leading `--'.  For
1868
instance, `--help' is accepted.
1869
 
1870
`-keep'
1871
`-keepgenerated'
1872
     By default, `grmic' deletes intermediate files.  Either of these
1873
     options causes it not to delete such files.
1874
 
1875
`-v1.1'
1876
     Cause `grmic' to create stubs and skeletons for the 1.1 protocol
1877
     version.
1878
 
1879
`-vcompat'
1880
     Cause `grmic' to create stubs and skeletons compatible with both
1881
     the 1.1 and 1.2 protocol versions.  This is the default.
1882
 
1883
`-v1.2'
1884
     Cause `grmic' to create stubs and skeletons for the 1.2 protocol
1885
     version.
1886
 
1887
`-nocompile'
1888
     Don't compile the generated files.
1889
 
1890
`-verbose'
1891
     Print information about what `grmic' is doing.
1892
 
1893
`-d DIRECTORY'
1894
     Put output files in DIRECTORY.  By default the files are put in
1895
     the current working directory.
1896
 
1897
`-help'
1898
     Print a help message, then exit.
1899
 
1900
`-version'
1901
     Print version information, then exit.
1902
 
1903

1904
File: gcj.info,  Node: Invoking grmiregistry,  Next: About CNI,  Prev: Invoking grmic,  Up: Top
1905
 
1906
11 Invoking grmiregistry
1907
************************
1908
 
1909
`grmic' [`OPTION'] ... [PORT]
1910
 
1911
   `grmiregistry' starts a remote object registry on the current host.
1912
If no port number is specified, then port 1099 is used.
1913
 
1914
`--help'
1915
     Print a help message, then exit.
1916
 
1917
`--version'
1918
     Print version information, then exit.
1919
 
1920

1921
File: gcj.info,  Node: About CNI,  Next: System properties,  Prev: Invoking grmiregistry,  Up: Top
1922
 
1923
12 About CNI
1924
************
1925
 
1926
This documents CNI, the Compiled Native Interface, which is is a
1927
convenient way to write Java native methods using C++.  This is a more
1928
efficient, more convenient, but less portable alternative to the
1929
standard JNI (Java Native Interface).
1930
 
1931
* Menu:
1932
 
1933
* Basic concepts::              Introduction to using CNI.
1934
* Packages::                    How packages are mapped to C++.
1935
* Primitive types::             Handling primitive Java types in C++.
1936
* Reference types::             Handling Java reference types in C++.
1937
* Interfaces::                  How Java interfaces map to C++.
1938
* Objects and Classes::         C++ and Java classes.
1939
* Class Initialization::        How objects are initialized.
1940
* Object allocation::           How to create Java objects in C++.
1941
* Memory allocation::           How to allocate and free memory.
1942
* Arrays::                      Dealing with Java arrays in C++.
1943
* Methods::                     Java methods in C++.
1944
* Strings::                     Information about Java Strings.
1945
* Mixing with C++::             How CNI can interoperate with C++.
1946
* Exception Handling::          How exceptions are handled.
1947
* Synchronization::             Synchronizing between Java and C++.
1948
* Invocation::                  Starting the Java runtime from C++.
1949
* Reflection::                  Using reflection from C++.
1950
 
1951

1952
File: gcj.info,  Node: Basic concepts,  Next: Packages,  Up: About CNI
1953
 
1954
12.1 Basic concepts
1955
===================
1956
 
1957
In terms of languages features, Java is mostly a subset of C++.  Java
1958
has a few important extensions, plus a powerful standard class library,
1959
but on the whole that does not change the basic similarity.  Java is a
1960
hybrid object-oriented language, with a few native types, in addition
1961
to class types.  It is class-based, where a class may have static as
1962
well as per-object fields, and static as well as instance methods.
1963
Non-static methods may be virtual, and may be overloaded.  Overloading
1964
is resolved at compile time by matching the actual argument types
1965
against the parameter types.  Virtual methods are implemented using
1966
indirect calls through a dispatch table (virtual function table).
1967
Objects are allocated on the heap, and initialized using a constructor
1968
method.  Classes are organized in a package hierarchy.
1969
 
1970
   All of the listed attributes are also true of C++, though C++ has
1971
extra features (for example in C++ objects may be allocated not just on
1972
the heap, but also statically or in a local stack frame).  Because
1973
`gcj' uses the same compiler technology as G++ (the GNU C++ compiler),
1974
it is possible to make the intersection of the two languages use the
1975
same ABI (object representation and calling conventions).  The key idea
1976
in CNI is that Java objects are C++ objects, and all Java classes are
1977
C++ classes (but not the other way around).  So the most important task
1978
in integrating Java and C++ is to remove gratuitous incompatibilities.
1979
 
1980
   You write CNI code as a regular C++ source file.  (You do have to use
1981
a Java/CNI-aware C++ compiler, specifically a recent version of G++.)
1982
 
1983
A CNI C++ source file must have:
1984
 
1985
     #include 
1986
 
1987
and then must include one header file for each Java class it uses, e.g.:
1988
 
1989
     #include 
1990
     #include 
1991
     #include 
1992
 
1993
These header files are automatically generated by `gcjh'.
1994
 
1995
   CNI provides some functions and macros to make using Java objects and
1996
primitive types from C++ easier.  In general, these CNI functions and
1997
macros start with the `Jv' prefix, for example the function
1998
`JvNewObjectArray'.  This convention is used to avoid conflicts with
1999
other libraries.  Internal functions in CNI start with the prefix
2000
`_Jv_'.  You should not call these; if you find a need to, let us know
2001
and we will try to come up with an alternate solution.
2002
 
2003
12.1.1 Limitations
2004
------------------
2005
 
2006
Whilst a Java class is just a C++ class that doesn't mean that you are
2007
freed from the shackles of Java, a CNI C++ class must adhere to the
2008
rules of the Java programming language.
2009
 
2010
   For example: it is not possible to declare a method in a CNI class
2011
that will take a C string (`char*') as an argument, or to declare a
2012
member variable of some non-Java datatype.
2013
 
2014

2015
File: gcj.info,  Node: Packages,  Next: Primitive types,  Prev: Basic concepts,  Up: About CNI
2016
 
2017
12.2 Packages
2018
=============
2019
 
2020
The only global names in Java are class names, and packages.  A
2021
"package" can contain zero or more classes, and also zero or more
2022
sub-packages.  Every class belongs to either an unnamed package or a
2023
package that has a hierarchical and globally unique name.
2024
 
2025
   A Java package is mapped to a C++ "namespace".  The Java class
2026
`java.lang.String' is in the package `java.lang', which is a
2027
sub-package of `java'.  The C++ equivalent is the class
2028
`java::lang::String', which is in the namespace `java::lang' which is
2029
in the namespace `java'.
2030
 
2031
Here is how you could express this:
2032
 
2033
     (// Declare the class(es), possibly in a header file:
2034
     namespace java {
2035
       namespace lang {
2036
         class Object;
2037
         class String;
2038
         ...
2039
       }
2040
     }
2041
 
2042
     class java::lang::String : public java::lang::Object
2043
     {
2044
       ...
2045
     };
2046
 
2047
The `gcjh' tool automatically generates the necessary namespace
2048
declarations.
2049
 
2050
12.2.1 Leaving out package names
2051
--------------------------------
2052
 
2053
Always using the fully-qualified name of a java class can be tiresomely
2054
verbose.  Using the full qualified name also ties the code to a single
2055
package making code changes necessary should the class move from one
2056
package to another.  The Java `package' declaration specifies that the
2057
following class declarations are in the named package, without having
2058
to explicitly name the full package qualifiers.  The `package'
2059
declaration can be followed by zero or more `import' declarations, which
2060
allows either a single class or all the classes in a package to be
2061
named by a simple identifier.  C++ provides something similar with the
2062
`using' declaration and directive.
2063
 
2064
In Java:
2065
 
2066
     import PACKAGE-NAME.CLASS-NAME;
2067
 
2068
allows the program text to refer to CLASS-NAME as a shorthand for the
2069
fully qualified name: `PACKAGE-NAME.CLASS-NAME'.
2070
 
2071
To achieve the same effect C++, you have to do this:
2072
 
2073
     using PACKAGE-NAME::CLASS-NAME;
2074
 
2075
Java can also cause imports on demand, like this:
2076
 
2077
     import PACKAGE-NAME.*;
2078
 
2079
Doing this allows any class from the package PACKAGE-NAME to be
2080
referred to only by its class-name within the program text.
2081
 
2082
The same effect can be achieved in C++ like this:
2083
 
2084
     using namespace PACKAGE-NAME;
2085
 
2086

2087
File: gcj.info,  Node: Primitive types,  Next: Reference types,  Prev: Packages,  Up: About CNI
2088
 
2089
12.3 Primitive types
2090
====================
2091
 
2092
Java provides 8 "primitives" types which represent integers, floats,
2093
characters and booleans (and also the void type).  C++ has its own very
2094
similar concrete types.  Such types in C++ however are not always
2095
implemented in the same way (an int might be 16, 32 or 64 bits for
2096
example) so CNI provides a special C++ type for each primitive Java
2097
type:
2098
 
2099
*Java type*    *C/C++ typename*   *Description*
2100
`char'         `jchar'            16 bit Unicode character
2101
`boolean'      `jboolean'         logical (true or false) values
2102
`byte'         `jbyte'            8-bit signed integer
2103
`short'        `jshort'           16 bit signed integer
2104
`int'          `jint'             32 bit signed integer
2105
`long'         `jlong'            64 bit signed integer
2106
`float'        `jfloat'           32 bit IEEE floating point number
2107
`double'       `jdouble'          64 bit IEEE floating point number
2108
`void'         `void'             no value
2109
 
2110
   When referring to a Java type You should always use these C++
2111
typenames (e.g.: `jint') to avoid disappointment.
2112
 
2113
12.3.1 Reference types associated with primitive types
2114
------------------------------------------------------
2115
 
2116
In Java each primitive type has an associated reference type, e.g.:
2117
`boolean' has an associated `java.lang.Boolean.TYPE' class.  In order
2118
to make working with such classes easier GCJ provides the macro
2119
`JvPrimClass':
2120
 
2121
 -- macro: JvPrimClass type
2122
     Return a pointer to the `Class' object corresponding to the type
2123
     supplied.
2124
 
2125
          JvPrimClass(void) => java.lang.Void.TYPE
2126
 
2127
 
2128

2129
File: gcj.info,  Node: Reference types,  Next: Interfaces,  Prev: Primitive types,  Up: About CNI
2130
 
2131
12.4 Reference types
2132
====================
2133
 
2134
A Java reference type is treated as a class in C++.  Classes and
2135
interfaces are handled this way.  A Java reference is translated to a
2136
C++ pointer, so for instance a Java `java.lang.String' becomes, in C++,
2137
`java::lang::String *'.
2138
 
2139
   CNI provides a few built-in typedefs for the most common classes:
2140
*Java type*            *C++ typename*     *Description*
2141
`java.lang.Object'     `jobject'          Object type
2142
`java.lang.String'     `jstring'          String type
2143
`java.lang.Class'      `jclass'           Class type
2144
 
2145
   Every Java class or interface has a corresponding `Class' instance.
2146
These can be accessed in CNI via the static `class$' field of a class.
2147
The `class$' field is of type `Class' (and not `Class *'), so you will
2148
typically take the address of it.
2149
 
2150
   Here is how you can refer to the class of `String', which in Java
2151
would be written `String.class':
2152
 
2153
     using namespace java::lang;
2154
     doSomething (&String::class$);
2155
 
2156

2157
File: gcj.info,  Node: Interfaces,  Next: Objects and Classes,  Prev: Reference types,  Up: About CNI
2158
 
2159
12.5 Interfaces
2160
===============
2161
 
2162
A Java class can "implement" zero or more "interfaces", in addition to
2163
inheriting from a single base class.
2164
 
2165
   CNI allows CNI code to implement methods of interfaces.  You can
2166
also call methods through interface references, with some limitations.
2167
 
2168
   CNI doesn't understand interface inheritance at all yet.  So, you
2169
can only call an interface method when the declared type of the field
2170
being called matches the interface which declares that method.  The
2171
workaround is to cast the interface reference to the right
2172
superinterface.
2173
 
2174
   For example if you have:
2175
 
2176
     interface A
2177
     {
2178
       void a();
2179
     }
2180
 
2181
     interface B extends A
2182
     {
2183
       void b();
2184
     }
2185
 
2186
   and declare a variable of type `B' in C++, you can't call `a()'
2187
unless you cast it to an `A' first.
2188
 
2189

2190
File: gcj.info,  Node: Objects and Classes,  Next: Class Initialization,  Prev: Interfaces,  Up: About CNI
2191
 
2192
12.6 Objects and Classes
2193
========================
2194
 
2195
12.6.1 Classes
2196
--------------
2197
 
2198
All Java classes are derived from `java.lang.Object'.  C++ does not
2199
have a unique root class, but we use the C++ class `java::lang::Object'
2200
as the C++ version of the `java.lang.Object' Java class.  All other
2201
Java classes are mapped into corresponding C++ classes derived from
2202
`java::lang::Object'.
2203
 
2204
   Interface inheritance (the `implements' keyword) is currently not
2205
reflected in the C++ mapping.
2206
 
2207
12.6.2 Object fields
2208
--------------------
2209
 
2210
Each object contains an object header, followed by the instance fields
2211
of the class, in order.  The object header consists of a single pointer
2212
to a dispatch or virtual function table.  (There may be extra fields
2213
_in front of_ the object, for example for memory management, but this
2214
is invisible to the application, and the reference to the object points
2215
to the dispatch table pointer.)
2216
 
2217
   The fields are laid out in the same order, alignment, and size as in
2218
C++.  Specifically, 8-bit and 16-bit native types (`byte', `short',
2219
`char', and `boolean') are _not_ widened to 32 bits.  Note that the
2220
Java VM does extend 8-bit and 16-bit types to 32 bits when on the VM
2221
stack or temporary registers.
2222
 
2223
   If you include the `gcjh'-generated header for a class, you can
2224
access fields of Java classes in the _natural_ way.  For example, given
2225
the following Java class:
2226
 
2227
     public class Int
2228
     {
2229
       public int i;
2230
       public Int (int i) { this.i = i; }
2231
       public static Int zero = new Int(0);
2232
     }
2233
 
2234
   you can write:
2235
 
2236
     #include ;
2237
     #include ;
2238
 
2239
     Int*
2240
     mult (Int *p, jint k)
2241
     {
2242
       if (k == 0)
2243
         return Int::zero;  // Static member access.
2244
       return new Int(p->i * k);
2245
     }
2246
 
2247
12.6.3 Access specifiers
2248
------------------------
2249
 
2250
CNI does not strictly enforce the Java access specifiers, because Java
2251
permissions cannot be directly mapped into C++ permission.  Private
2252
Java fields and methods are mapped to private C++ fields and methods,
2253
but other fields and methods are mapped to public fields and methods.
2254
 
2255

2256
File: gcj.info,  Node: Class Initialization,  Next: Object allocation,  Prev: Objects and Classes,  Up: About CNI
2257
 
2258
12.7 Class Initialization
2259
=========================
2260
 
2261
Java requires that each class be automatically initialized at the time
2262
of the first active use.  Initializing a class involves initializing
2263
the static fields, running code in class initializer methods, and
2264
initializing base classes.  There may also be some implementation
2265
specific actions, such as allocating `String' objects corresponding to
2266
string literals in the code.
2267
 
2268
   The GCJ compiler inserts calls to `JvInitClass' at appropriate
2269
places to ensure that a class is initialized when required.  The C++
2270
compiler does not insert these calls automatically--it is the
2271
programmer's responsibility to make sure classes are initialized.
2272
However, this is fairly painless because of the conventions assumed by
2273
the Java system.
2274
 
2275
   First, `libgcj' will make sure a class is initialized before an
2276
instance of that object is created.  This is one of the
2277
responsibilities of the `new' operation.  This is taken care of both in
2278
Java code, and in C++ code.  When G++ sees a `new' of a Java class, it
2279
will call a routine in `libgcj' to allocate the object, and that
2280
routine will take care of initializing the class.  Note however that
2281
this does not happen for Java arrays; you must allocate those using the
2282
appropriate CNI function.  It follows that you can access an instance
2283
field, or call an instance (non-static) method and be safe in the
2284
knowledge that the class and all of its base classes have been
2285
initialized.
2286
 
2287
   Invoking a static method is also safe.  This is because the Java
2288
compiler adds code to the start of a static method to make sure the
2289
class is initialized.  However, the C++ compiler does not add this
2290
extra code.  Hence, if you write a native static method using CNI, you
2291
are responsible for calling `JvInitClass' before doing anything else in
2292
the method (unless you are sure it is safe to leave it out).
2293
 
2294
   Accessing a static field also requires the class of the field to be
2295
initialized.  The Java compiler will generate code to call
2296
`JvInitClass' before getting or setting the field.  However, the C++
2297
compiler will not generate this extra code, so it is your
2298
responsibility to make sure the class is initialized before you access
2299
a static field from C++.
2300
 
2301

2302
File: gcj.info,  Node: Object allocation,  Next: Memory allocation,  Prev: Class Initialization,  Up: About CNI
2303
 
2304
12.8 Object allocation
2305
======================
2306
 
2307
New Java objects are allocated using a "class instance creation
2308
expression", e.g.:
2309
 
2310
     new TYPE ( ... )
2311
 
2312
   The same syntax is used in C++.  The main difference is that C++
2313
objects have to be explicitly deleted; in Java they are automatically
2314
deleted by the garbage collector.  Using CNI, you can allocate a new
2315
Java object using standard C++ syntax and the C++ compiler will allocate
2316
memory from the garbage collector.  If you have overloaded
2317
constructors, the compiler will choose the correct one using standard
2318
C++ overload resolution rules.
2319
 
2320
For example:
2321
 
2322
     java::util::Hashtable *ht = new java::util::Hashtable(120);
2323
 
2324

2325
File: gcj.info,  Node: Memory allocation,  Next: Arrays,  Prev: Object allocation,  Up: About CNI
2326
 
2327
12.9 Memory allocation
2328
======================
2329
 
2330
When allocating memory in CNI methods it is best to handle
2331
out-of-memory conditions by throwing a Java exception.  These functions
2332
are provided for that purpose:
2333
 
2334
 -- Function: void* JvMalloc (jsize SIZE)
2335
     Calls malloc.  Throws `java.lang.OutOfMemoryError' if allocation
2336
     fails.
2337
 
2338
 -- Function: void* JvRealloc (void* PTR, jsize SIZE)
2339
     Calls realloc.  Throws `java.lang.OutOfMemoryError' if
2340
     reallocation fails.
2341
 
2342
 -- Function: void JvFree (void* PTR)
2343
     Calls free.
2344
 
2345

2346
File: gcj.info,  Node: Arrays,  Next: Methods,  Prev: Memory allocation,  Up: About CNI
2347
 
2348
12.10 Arrays
2349
============
2350
 
2351
While in many ways Java is similar to C and C++, it is quite different
2352
in its treatment of arrays.  C arrays are based on the idea of pointer
2353
arithmetic, which would be incompatible with Java's security
2354
requirements.  Java arrays are true objects (array types inherit from
2355
`java.lang.Object').  An array-valued variable is one that contains a
2356
reference (pointer) to an array object.
2357
 
2358
   Referencing a Java array in C++ code is done using the `JArray'
2359
template, which as defined as follows:
2360
 
2361
     class __JArray : public java::lang::Object
2362
     {
2363
     public:
2364
       int length;
2365
     };
2366
 
2367
     template
2368
     class JArray : public __JArray
2369
     {
2370
       T data[0];
2371
     public:
2372
       T& operator[](jint i) { return data[i]; }
2373
     };
2374
 
2375
   There are a number of `typedef's which correspond to `typedef's from
2376
the JNI.  Each is the type of an array holding objects of the relevant
2377
type:
2378
 
2379
     typedef __JArray *jarray;
2380
     typedef JArray *jobjectArray;
2381
     typedef JArray *jbooleanArray;
2382
     typedef JArray *jbyteArray;
2383
     typedef JArray *jcharArray;
2384
     typedef JArray *jshortArray;
2385
     typedef JArray *jintArray;
2386
     typedef JArray *jlongArray;
2387
     typedef JArray *jfloatArray;
2388
     typedef JArray *jdoubleArray;
2389
 
2390
 -- Method on template: T* elements (JArray ARRAY)
2391
     This template function can be used to get a pointer to the
2392
     elements of the `array'.  For instance, you can fetch a pointer to
2393
     the integers that make up an `int[]' like so:
2394
 
2395
          extern jintArray foo;
2396
          jint *intp = elements (foo);
2397
 
2398
     The name of this function may change in the future.
2399
 
2400
 -- Function: jobjectArray JvNewObjectArray (jsize LENGTH, jclass
2401
          KLASS, jobject INIT)
2402
     This creates a new array whose elements have reference type.
2403
     `klass' is the type of elements of the array and `init' is the
2404
     initial value put into every slot in the array.
2405
 
2406
     using namespace java::lang;
2407
     JArray *array
2408
       = (JArray *) JvNewObjectArray(length, &String::class$, NULL);
2409
 
2410
12.10.1 Creating arrays
2411
-----------------------
2412
 
2413
For each primitive type there is a function which can be used to create
2414
a new array of that type.  The name of the function is of the form:
2415
 
2416
     JvNewTYPEArray
2417
 
2418
For example:
2419
 
2420
     JvNewBooleanArray
2421
 
2422
can be used to create an array of Java primitive boolean types.
2423
 
2424
The following function definition is the template for all such
2425
functions:
2426
 
2427
 -- Function: jbooleanArray JvNewBooleanArray (jint LENGTH)
2428
     Create's an array LENGTH indices long.
2429
 
2430
 -- Function: jsize JvGetArrayLength (jarray ARRAY)
2431
     Returns the length of the ARRAY.
2432
 
2433

2434
File: gcj.info,  Node: Methods,  Next: Strings,  Prev: Arrays,  Up: About CNI
2435
 
2436
12.11 Methods
2437
=============
2438
 
2439
Java methods are mapped directly into C++ methods.  The header files
2440
generated by `gcjh' include the appropriate method definitions.
2441
Basically, the generated methods have the same names and
2442
_corresponding_ types as the Java methods, and are called in the
2443
natural manner.
2444
 
2445
12.11.1 Overloading
2446
-------------------
2447
 
2448
Both Java and C++ provide method overloading, where multiple methods in
2449
a class have the same name, and the correct one is chosen (at compile
2450
time) depending on the argument types.  The rules for choosing the
2451
correct method are (as expected) more complicated in C++ than in Java,
2452
but given a set of overloaded methods generated by `gcjh' the C++
2453
compiler will choose the expected one.
2454
 
2455
   Common assemblers and linkers are not aware of C++ overloading, so
2456
the standard implementation strategy is to encode the parameter types
2457
of a method into its assembly-level name.  This encoding is called
2458
"mangling", and the encoded name is the "mangled name".  The same
2459
mechanism is used to implement Java overloading.  For C++/Java
2460
interoperability, it is important that both the Java and C++ compilers
2461
use the _same_ encoding scheme.
2462
 
2463
12.11.2 Static methods
2464
----------------------
2465
 
2466
Static Java methods are invoked in CNI using the standard C++ syntax,
2467
using the `::' operator rather than the `.' operator.
2468
 
2469
For example:
2470
 
2471
     jint i = java::lang::Math::round((jfloat) 2.3);
2472
 
2473
C++ method definition syntax is used to define a static native method.
2474
For example:
2475
 
2476
     #include 
2477
     java::lang::Integer*
2478
     java::lang::Integer::getInteger(jstring str)
2479
     {
2480
       ...
2481
     }
2482
 
2483
12.11.3 Object Constructors
2484
---------------------------
2485
 
2486
Constructors are called implicitly as part of object allocation using
2487
the `new' operator.
2488
 
2489
For example:
2490
 
2491
     java::lang::Integer *x = new java::lang::Integer(234);
2492
 
2493
   Java does not allow a constructor to be a native method.  This
2494
limitation can be coded round however because a constructor can _call_
2495
a native method.
2496
 
2497
12.11.4 Instance methods
2498
------------------------
2499
 
2500
Calling a Java instance method from a C++ CNI method is done using the
2501
standard C++ syntax, e.g.:
2502
 
2503
     // First create the Java object.
2504
     java::lang::Integer *x = new java::lang::Integer(234);
2505
     // Now call a method.
2506
     jint prim_value = x->intValue();
2507
     if (x->longValue == 0)
2508
       ...
2509
 
2510
Defining a Java native instance method is also done the natural way:
2511
 
2512
     #include 
2513
 
2514
     jdouble
2515
     java::lang:Integer::doubleValue()
2516
     {
2517
       return (jdouble) value;
2518
     }
2519
 
2520
12.11.5 Interface methods
2521
-------------------------
2522
 
2523
In Java you can call a method using an interface reference.  This is
2524
supported, but not completely.  *Note Interfaces::.
2525
 
2526

2527
File: gcj.info,  Node: Strings,  Next: Mixing with C++,  Prev: Methods,  Up: About CNI
2528
 
2529
12.12 Strings
2530
=============
2531
 
2532
CNI provides a number of utility functions for working with Java Java
2533
`String' objects.  The names and interfaces are analogous to those of
2534
JNI.
2535
 
2536
 -- Function: jstring JvNewString (const char* CHARS, jsize LEN)
2537
     Returns a Java `String' object with characters from the C string
2538
     CHARS up to the index LEN in that array.
2539
 
2540
 -- Function: jstring JvNewStringLatin1 (const char* BYTES, jsize LEN)
2541
     Returns a Java `String' made up of LEN bytes from BYTES.
2542
 
2543
 -- Function: jstring JvNewStringLatin1 (const char* BYTES)
2544
     As above but the length of the `String' is `strlen(BYTES)'.
2545
 
2546
 -- Function: jstring JvNewStringUTF (const char* BYTES)
2547
     Returns a `String' which is made up of the UTF encoded characters
2548
     present in the C string BYTES.
2549
 
2550
 -- Function: jchar* JvGetStringChars (jstring STR)
2551
     Returns a pointer to an array of characters making up the `String'
2552
     STR.
2553
 
2554
 -- Function: int JvGetStringUTFLength (jstring STR)
2555
     Returns the number of bytes required to encode the contents of the
2556
     `String' STR in UTF-8.
2557
 
2558
 -- Function: jsize JvGetStringUTFRegion (jstring STR, jsize START,
2559
          jsize LEN, char* BUF)
2560
     Puts the UTF-8 encoding of a region of the `String' STR into the
2561
     buffer `buf'.  The region to fetch is marked by START and LEN.
2562
 
2563
     Note that BUF is a buffer, not a C string.  It is _not_ null
2564
     terminated.
2565
 
2566

2567
File: gcj.info,  Node: Mixing with C++,  Next: Exception Handling,  Prev: Strings,  Up: About CNI
2568
 
2569
12.13 Interoperating with C/C++
2570
===============================
2571
 
2572
Because CNI is designed to represent Java classes and methods it cannot
2573
be mixed readily with C/C++ types.
2574
 
2575
   One important restriction is that Java classes cannot have non-Java
2576
type instance or static variables and cannot have methods which take
2577
non-Java types as arguments or return non-Java types.
2578
 
2579
None of the following is possible with CNI:
2580
 
2581
 
2582
     class ::MyClass : public java::lang::Object
2583
     {
2584
        char* variable;  // char* is not a valid Java type.
2585
     }
2586
 
2587
 
2588
     uint
2589
     ::SomeClass::someMethod (char *arg)
2590
     {
2591
       .
2592
       .
2593
       .
2594
     }   // `uint' is not a valid Java type, neither is `char*'
2595
 
2596
Of course, it is ok to use C/C++ types within the scope of a method:
2597
 
2598
     jint
2599
     ::SomeClass::otherMethod (jstring str)
2600
     {
2601
        char *arg = ...
2602
        .
2603
        .
2604
        .
2605
     }
2606
 
2607
12.13.1 RawData
2608
---------------
2609
 
2610
The above restriction can be problematic, so CNI includes the
2611
`gnu.gcj.RawData' class.  The `RawData' class is a "non-scanned
2612
reference" type.  In other words variables declared of type `RawData'
2613
can contain any data and are not checked by the compiler or memory
2614
manager in any way.
2615
 
2616
   This means that you can put C/C++ data structures (including classes)
2617
in your CNI classes, as long as you use the appropriate cast.
2618
 
2619
Here are some examples:
2620
 
2621
 
2622
     class ::MyClass : public java::lang::Object
2623
     {
2624
        gnu.gcj.RawData string;
2625
 
2626
        MyClass ();
2627
        gnu.gcj.RawData getText ();
2628
        void printText ();
2629
     }
2630
 
2631
     ::MyClass::MyClass ()
2632
     {
2633
        char* text = ...
2634
        string = text;
2635
     }
2636
 
2637
     gnu.gcj.RawData
2638
     ::MyClass::getText ()
2639
     {
2640
        return string;
2641
     }
2642
 
2643
     void
2644
     ::MyClass::printText ()
2645
     {
2646
       printf("%s\n", (char*) string);
2647
     }
2648
 
2649
12.13.2 RawDataManaged
2650
----------------------
2651
 
2652
`gnu.gcj.RawDataManaged' is another type used to indicate special data
2653
used by native code. Unlike the `RawData' type, fields declared as
2654
`RawDataManaged' will be "marked" by the memory manager and considered
2655
for garbage collection.
2656
 
2657
   Native data which is allocated using CNI's `JvAllocBytes()' function
2658
and stored in a `RawDataManaged' will be automatically freed when the
2659
Java object it is associated with becomes unreachable.
2660
 
2661
12.13.3 Native memory allocation
2662
--------------------------------
2663
 
2664
 -- Function: void* JvAllocBytes (jsize SIZE)
2665
     Allocates SIZE bytes from the heap.  The memory returned is zeroed.
2666
     This memory is not scanned for pointers by the garbage collector,
2667
     but will be freed if no references to it are discovered.
2668
 
2669
     This function can be useful if you need to associate some native
2670
     data with a Java object. Using a CNI's special `RawDataManaged'
2671
     type, native data allocated with `JvAllocBytes' will be
2672
     automatically freed when the Java object itself becomes
2673
     unreachable.
2674
 
2675
12.13.4 Posix signals
2676
---------------------
2677
 
2678
On Posix based systems the `libgcj' library uses several signals
2679
internally.  CNI code should not attempt to use the same signals as
2680
doing so may cause `libgcj' and/or the CNI code to fail.
2681
 
2682
   SIGSEGV is used on many systems to generate `NullPointerExceptions'.
2683
SIGCHLD is used internally by `Runtime.exec()'.  Several other signals
2684
(that vary from platform to platform) can be used by the memory manager
2685
and by `Thread.interrupt()'.
2686
 
2687

2688
File: gcj.info,  Node: Exception Handling,  Next: Synchronization,  Prev: Mixing with C++,  Up: About CNI
2689
 
2690
12.14 Exception Handling
2691
========================
2692
 
2693
While C++ and Java share a common exception handling framework, things
2694
are not yet perfectly integrated.  The main issue is that the run-time
2695
type information facilities of the two languages are not integrated.
2696
 
2697
   Still, things work fairly well.  You can throw a Java exception from
2698
C++ using the ordinary `throw' construct, and this exception can be
2699
caught by Java code.  Similarly, you can catch an exception thrown from
2700
Java using the C++ `catch' construct.
2701
 
2702
Here is an example:
2703
 
2704
     if (i >= count)
2705
        throw new java::lang::IndexOutOfBoundsException();
2706
 
2707
   Normally, G++ will automatically detect when you are writing C++
2708
code that uses Java exceptions, and handle them appropriately.
2709
However, if C++ code only needs to execute destructors when Java
2710
exceptions are thrown through it, GCC will guess incorrectly.  Sample
2711
problematic code:
2712
 
2713
     struct S { ~S(); };
2714
 
2715
     extern void bar();    // Is implemented in Java and may throw exceptions.
2716
 
2717
     void foo()
2718
     {
2719
       S s;
2720
       bar();
2721
     }
2722
 
2723
   The usual effect of an incorrect guess is a link failure,
2724
complaining of a missing routine called `__gxx_personality_v0'.
2725
 
2726
   You can inform the compiler that Java exceptions are to be used in a
2727
translation unit, irrespective of what it might think, by writing
2728
`#pragma GCC java_exceptions' at the head of the file.  This `#pragma'
2729
must appear before any functions that throw or catch exceptions, or run
2730
destructors when exceptions are thrown through them.
2731
 
2732

2733
File: gcj.info,  Node: Synchronization,  Next: Invocation,  Prev: Exception Handling,  Up: About CNI
2734
 
2735
12.15 Synchronization
2736
=====================
2737
 
2738
Each Java object has an implicit monitor.  The Java VM uses the
2739
instruction `monitorenter' to acquire and lock a monitor, and
2740
`monitorexit' to release it.
2741
 
2742
   The corresponding CNI macros are `JvMonitorEnter' and
2743
`JvMonitorExit' (JNI has similar  methods `MonitorEnter' and
2744
`MonitorExit').
2745
 
2746
   The Java source language does not provide direct access to these
2747
primitives.  Instead, there is a `synchronized' statement that does an
2748
implicit `monitorenter' before entry to the block, and does a
2749
`monitorexit' on exit from the block.  Note that the lock has to be
2750
released even when the block is abnormally terminated by an exception,
2751
which means there is an implicit `try finally' surrounding
2752
synchronization locks.
2753
 
2754
   From C++, it makes sense to use a destructor to release a lock.  CNI
2755
defines the following utility class:
2756
 
2757
     class JvSynchronize() {
2758
       jobject obj;
2759
       JvSynchronize(jobject o) { obj = o; JvMonitorEnter(o); }
2760
       ~JvSynchronize() { JvMonitorExit(obj); }
2761
     };
2762
 
2763
   So this Java code:
2764
 
2765
     synchronized (OBJ)
2766
     {
2767
        CODE
2768
     }
2769
 
2770
might become this C++ code:
2771
 
2772
     {
2773
        JvSynchronize dummy (OBJ);
2774
        CODE;
2775
     }
2776
 
2777
   Java also has methods with the `synchronized' attribute.  This is
2778
equivalent to wrapping the entire method body in a `synchronized'
2779
statement.  (Alternatively, an implementation could require the caller
2780
to do the synchronization.  This is not practical for a compiler,
2781
because each virtual method call would have to test at run-time if
2782
synchronization is needed.)  Since in `gcj' the `synchronized'
2783
attribute is handled by the method implementation, it is up to the
2784
programmer of a synchronized native method to handle the synchronization
2785
(in the C++ implementation of the method).  In other words, you need to
2786
manually add `JvSynchronize' in a `native synchronized' method.
2787
 
2788

2789
File: gcj.info,  Node: Invocation,  Next: Reflection,  Prev: Synchronization,  Up: About CNI
2790
 
2791
12.16 Invocation
2792
================
2793
 
2794
CNI permits C++ applications to make calls into Java classes, in
2795
addition to allowing Java code to call into C++. Several functions,
2796
known as the "invocation API", are provided to support this.
2797
 
2798
 -- Function: jint JvCreateJavaVM (JvVMInitArgs* VM_ARGS)
2799
     Initializes the Java runtime. This function performs essential
2800
     initialization of the threads interface, garbage collector,
2801
     exception handling and other key aspects of the runtime. It must
2802
     be called once by an application with a non-Java `main()'
2803
     function, before any other Java or CNI calls are made.  It is
2804
     safe, but not recommended, to call `JvCreateJavaVM()' more than
2805
     once provided it is only called from a single thread.  The VMARGS
2806
     parameter can be used to specify initialization parameters for the
2807
     Java runtime. It may be `NULL'.
2808
 
2809
     JvVMInitArgs represents a list of virtual machine initialization
2810
     arguments. `JvCreateJavaVM()' ignores the version field.
2811
 
2812
          typedef struct JvVMOption
2813
          {
2814
            // a VM initialization option
2815
            char* optionString;
2816
            // extra information associated with this option
2817
            void* extraInfo;
2818
          } JvVMOption;
2819
 
2820
          typedef struct JvVMInitArgs
2821
          {
2822
            // for compatibility with JavaVMInitArgs
2823
            jint version;
2824
 
2825
            // number of VM initialization options
2826
            jint nOptions;
2827
 
2828
            // an array of VM initialization options
2829
            JvVMOption* options;
2830
 
2831
            // true if the option parser should ignore unrecognized options
2832
            jboolean ignoreUnrecognized;
2833
          } JvVMInitArgs;
2834
 
2835
     `JvCreateJavaVM()' returns `0' upon success, or `-1' if the
2836
     runtime is already initialized.
2837
 
2838
     _Note:_ In GCJ 3.1, the `vm_args' parameter is ignored. It is
2839
     recognized and used as of release 4.0.
2840
 
2841
 -- Function: java::lang::Thread* JvAttachCurrentThread (jstring NAME,
2842
          java::lang::ThreadGroup* GROUP)
2843
     Registers an existing thread with the Java runtime.  This must be
2844
     called once from each thread, before that thread makes any other
2845
     Java or CNI calls. It must be called after `JvCreateJavaVM'.  NAME
2846
     specifies a name for the thread. It may be `NULL', in which case a
2847
     name will be generated.  GROUP is the ThreadGroup in which this
2848
     thread will be a member. If it is `NULL', the thread will be a
2849
     member of the main thread group.  The return value is the Java
2850
     `Thread' object that represents the thread.  It is safe to call
2851
     `JvAttachCurrentThread()' more than once from the same thread. If
2852
     the thread is already attached, the call is ignored and the current
2853
     thread object is returned.
2854
 
2855
 -- Function: jint JvDetachCurrentThread ()
2856
     Unregisters a thread from the Java runtime. This should be called
2857
     by threads that were attached using `JvAttachCurrentThread()',
2858
     after they have finished making calls to Java code. This ensures
2859
     that any resources associated with the thread become eligible for
2860
     garbage collection.  This function returns `0' upon success, or
2861
     `-1' if the current thread is not attached.
2862
 
2863
12.16.1 Handling uncaught exceptions
2864
------------------------------------
2865
 
2866
If an exception is thrown from Java code called using the invocation
2867
API, and no handler for the exception can be found, the runtime will
2868
abort the application. In order to make the application more robust, it
2869
is recommended that code which uses the invocation API be wrapped by a
2870
top-level try/catch block that catches all Java exceptions.
2871
 
2872
12.16.2 Example
2873
---------------
2874
 
2875
The following code demonstrates the use of the invocation API. In this
2876
example, the C++ application initializes the Java runtime and attaches
2877
itself. The `java.lang.System' class is initialized in order to access
2878
its `out' field, and a Java string is printed. Finally, the thread is
2879
detached from the runtime once it has finished making Java calls.
2880
Everything is wrapped with a try/catch block to provide a default
2881
handler for any uncaught exceptions.
2882
 
2883
   The example can be compiled with `c++ test.cc -lgcj'.
2884
 
2885
     // test.cc
2886
     #include 
2887
     #include 
2888
     #include 
2889
     #include 
2890
 
2891
     int main(int argc, char *argv)
2892
     {
2893
       using namespace java::lang;
2894
 
2895
       try
2896
       {
2897
         JvCreateJavaVM(NULL);
2898
         JvAttachCurrentThread(NULL, NULL);
2899
 
2900
         String *message = JvNewStringLatin1("Hello from C++");
2901
         JvInitClass(&System::class$);
2902
         System::out->println(message);
2903
 
2904
         JvDetachCurrentThread();
2905
       }
2906
       catch (Throwable *t)
2907
       {
2908
         System::err->println(JvNewStringLatin1("Unhandled Java exception:"));
2909
         t->printStackTrace();
2910
       }
2911
     }
2912
 
2913

2914
File: gcj.info,  Node: Reflection,  Prev: Invocation,  Up: About CNI
2915
 
2916
12.17 Reflection
2917
================
2918
 
2919
Reflection is possible with CNI code, it functions similarly to how it
2920
functions with JNI.
2921
 
2922
   The types `jfieldID' and `jmethodID' are as in JNI.
2923
 
2924
The functions:
2925
 
2926
   * `JvFromReflectedField',
2927
 
2928
   * `JvFromReflectedMethod',
2929
 
2930
   * `JvToReflectedField'
2931
 
2932
   * `JvToFromReflectedMethod'
2933
 
2934
will be added shortly, as will other functions corresponding to JNI.
2935
 
2936

2937
File: gcj.info,  Node: System properties,  Next: Resources,  Prev: About CNI,  Up: Top
2938
 
2939
13 System properties
2940
********************
2941
 
2942
The runtime behavior of the `libgcj' library can be modified by setting
2943
certain system properties.  These properties can be compiled into the
2944
program using the `-DNAME[=VALUE]' option to `gcj' or by setting them
2945
explicitly in the program by calling the
2946
`java.lang.System.setProperty()' method.  Some system properties are
2947
only used for informational purposes (like giving a version number or a
2948
user name).  A program can inspect the current value of a property by
2949
calling the `java.lang.System.getProperty()' method.
2950
 
2951
* Menu:
2952
 
2953
* Standard Properties::         Standard properties supported by `libgcj'
2954
* GNU Classpath Properties::    Properties found in Classpath based libraries
2955
* libgcj Runtime Properties::   Properties specific to `libgcj'
2956
 
2957

2958
File: gcj.info,  Node: Standard Properties,  Next: GNU Classpath Properties,  Up: System properties
2959
 
2960
13.1 Standard Properties
2961
========================
2962
 
2963
The following properties are normally found in all implementations of
2964
the core libraries for the Java language.
2965
 
2966
`java.version'
2967
     The `libgcj' version number.
2968
 
2969
`java.vendor'
2970
     Set to `The Free Software Foundation, Inc.'
2971
 
2972
`java.vendor.url'
2973
     Set to `http://gcc.gnu.org/java/'.
2974
 
2975
`java.home'
2976
     The directory where `gcj' was installed.  Taken from the `--prefix'
2977
     option given to `configure'.
2978
 
2979
`java.class.version'
2980
     The class format version number supported by the libgcj byte code
2981
     interpreter.  (Currently `46.0')
2982
 
2983
`java.vm.specification.version'
2984
     The Virtual Machine Specification version implemented by `libgcj'.
2985
     (Currently `1.0')
2986
 
2987
`java.vm.specification.vendor'
2988
     The name of the Virtual Machine specification designer.
2989
 
2990
`java.vm.specification.name'
2991
     The name of the Virtual Machine specification (Set to `Java
2992
     Virtual Machine Specification').
2993
 
2994
`java.vm.version'
2995
     The `gcj' version number.
2996
 
2997
`java.vm.vendor'
2998
     Set to `The Free Software Foundation, Inc.'
2999
 
3000
`java.vm.name'
3001
     Set to `GNU libgcj'.
3002
 
3003
`java.specification.version'
3004
     The Runtime Environment specification version implemented by
3005
     `libgcj'.  (Currently set to `1.3')
3006
 
3007
`java.specification.vendor'
3008
     The Runtime Environment specification designer.
3009
 
3010
`java.specification.name'
3011
     The name of the Runtime Environment specification (Set to `Java
3012
     Platform API Specification').
3013
 
3014
`java.class.path'
3015
     The paths (jar files, zip files and directories) used for finding
3016
     class files.
3017
 
3018
`java.library.path'
3019
     Directory path used for finding native libraries.
3020
 
3021
`java.io.tmpdir'
3022
     The directory used to put temporary files in.
3023
 
3024
`java.compiler'
3025
     Name of the Just In Time compiler to use by the byte code
3026
     interpreter.  Currently not used in `libgcj'.
3027
 
3028
`java.ext.dirs'
3029
     Directories containing jar files with extra libraries.  Will be
3030
     used when resolving classes.
3031
 
3032
`java.protocol.handler.pkgs'
3033
     A `|' separated list of package names that is used to find classes
3034
     that implement handlers for `java.net.URL'.
3035
 
3036
`java.rmi.server.codebase'
3037
     A list of URLs that is used by the `java.rmi.server.RMIClassLoader'
3038
     to load classes from.
3039
 
3040
`jdbc.drivers'
3041
     A list of class names that will be loaded by the
3042
     `java.sql.DriverManager' when it starts up.
3043
 
3044
`file.separator'
3045
     The separator used in when directories are included in a filename
3046
     (normally `/' or `\' ).
3047
 
3048
`file.encoding'
3049
     The default character encoding used when converting platform
3050
     native files to Unicode (usually set to `8859_1').
3051
 
3052
`path.separator'
3053
     The standard separator used when a string contains multiple paths
3054
     (normally `:' or `;'), the string is usually not a valid character
3055
     to use in normal directory names.)
3056
 
3057
`line.separator'
3058
     The default line separator used on the platform (normally `\n',
3059
     `\r' or a combination of those two characters).
3060
 
3061
`policy.provider'
3062
     The class name used for the default policy provider returned by
3063
     `java.security.Policy.getPolicy'.
3064
 
3065
`user.name'
3066
     The name of the user running the program.  Can be the full name,
3067
     the login name or empty if unknown.
3068
 
3069
`user.home'
3070
     The default directory to put user specific files in.
3071
 
3072
`user.dir'
3073
     The current working directory from which the program was started.
3074
 
3075
`user.language'
3076
     The default language as used by the `java.util.Locale' class.
3077
 
3078
`user.region'
3079
     The default region as used by the `java.util.Local' class.
3080
 
3081
`user.variant'
3082
     The default variant of the language and region local used.
3083
 
3084
`user.timezone'
3085
     The default timezone as used by the `java.util.TimeZone' class.
3086
 
3087
`os.name'
3088
     The operating system/kernel name that the program runs on.
3089
 
3090
`os.arch'
3091
     The hardware that we are running on.
3092
 
3093
`os.version'
3094
     The version number of the operating system/kernel.
3095
 
3096
`awt.appletWarning'
3097
     The string to display when an untrusted applet is displayed.
3098
     Returned by `java.awt.Window.getWarningString()' when the window is
3099
     "insecure".
3100
 
3101
`awt.toolkit'
3102
     The class name used for initializing the default
3103
     `java.awt.Toolkit'.  Defaults to `gnu.awt.gtk.GtkToolkit'.
3104
 
3105
`http.proxyHost'
3106
     Name of proxy host for http connections.
3107
 
3108
`http.proxyPort'
3109
     Port number to use when a proxy host is in use.
3110
 
3111
 
3112

3113
File: gcj.info,  Node: GNU Classpath Properties,  Next: libgcj Runtime Properties,  Prev: Standard Properties,  Up: System properties
3114
 
3115
13.2 GNU Classpath Properties
3116
=============================
3117
 
3118
`libgcj' is based on the GNU Classpath (Essential Libraries for Java) a
3119
GNU project to create free core class libraries for use with virtual
3120
machines and compilers for the Java language.  The following properties
3121
are common to libraries based on GNU Classpath.
3122
 
3123
`gcj.dumpobject'
3124
     Enables printing serialization debugging by the
3125
     `java.io.ObjectInput' and `java.io.ObjectOutput' classes when set
3126
     to something else then the empty string.  Only used when running a
3127
     debug build of the library.
3128
 
3129
`gnu.classpath.vm.shortname'
3130
     This is a succinct name of the virtual machine.  For `libgcj',
3131
     this will always be `libgcj'.
3132
 
3133
`gnu.classpath.home.url'
3134
     A base URL used for finding system property files (e.g.,
3135
     `classpath.security').  By default this is a `file:' URL pointing
3136
     to the `lib' directory under `java.home'.
3137
 
3138
 
3139

3140
File: gcj.info,  Node: libgcj Runtime Properties,  Prev: GNU Classpath Properties,  Up: System properties
3141
 
3142
13.3 libgcj Runtime Properties
3143
==============================
3144
 
3145
The following properties are specific to the `libgcj' runtime and will
3146
normally not be found in other core libraries for the java language.
3147
 
3148
`java.fullversion'
3149
     The combination of `java.vm.name' and `java.vm.version'.
3150
 
3151
`java.vm.info'
3152
     Same as `java.fullversion'.
3153
 
3154
`impl.prefix'
3155
     Used by the `java.net.DatagramSocket' class when set to something
3156
     else then the empty string.  When set all newly created
3157
     `DatagramSocket's will try to load a class
3158
     `java.net.[impl.prefix]DatagramSocketImpl' instead of the normal
3159
     `java.net.PlainDatagramSocketImpl'.
3160
 
3161
`gnu.gcj.progname'
3162
     The class or binary name that was used to invoke the program. This
3163
     will be the name of the "main" class in the case where the `gij'
3164
     front end is used, or the program binary name in the case where an
3165
     application is compiled to a native binary.
3166
 
3167
`gnu.gcj.runtime.NameFinder.use_addr2line'
3168
     Whether an external process, `addr2line', should be used to
3169
     determine line number information when tracing the stack. Setting
3170
     this to `false' may suppress line numbers when printing stack
3171
     traces and when using the java.util.logging infrastructure.
3172
     However, performance may improve significantly for applications
3173
     that print stack traces or make logging calls frequently.
3174
 
3175
`gnu.gcj.runtime.VMClassLoader.library_control'
3176
     This controls how shared libraries are automatically loaded by the
3177
     built-in class loader.  If this property is set to `full', a full
3178
     search is done for each requested class.  If this property is set
3179
     to `cache' (the default), then any failed lookups are cached and
3180
     not tried again.  If this property is set to `never', then lookups
3181
     are never done.  For more information, *Note Extensions::.
3182
 
3183
`gnu.gcj.runtime.endorsed.dirs'
3184
     This is like the standard `java.endorsed.dirs', property, but
3185
     specifies some extra directories which are searched after the
3186
     standard endorsed directories.  This is primarily useful for
3187
     telling `libgcj' about additional libraries which are ordinarily
3188
     incorporated into the JDK, and which should be loaded by the
3189
     bootstrap class loader, but which are not yet part of `libgcj'
3190
     itself for some reason.
3191
 
3192
`gnu.gcj.jit.compiler'
3193
     This is the full path to `gcj' executable which should be used to
3194
     compile classes just-in-time when `ClassLoader.defineClass' is
3195
     called.  If not set, `gcj' will not be invoked by the runtime;
3196
     this can also be controlled via `Compiler.disable'.
3197
 
3198
`gnu.gcj.jit.options'
3199
     This is a space-separated string of options which should be passed
3200
     to `gcj' when in JIT mode.  If not set, a sensible default is
3201
     chosen.
3202
 
3203
`gnu.gcj.jit.cachedir'
3204
     This is the directory where cached shared library files are
3205
     stored.  If not set, JIT compilation is disabled.  This should
3206
     never be set to a directory that is writable by any other user.
3207
 
3208
`gnu.gcj.precompiled.db.path'
3209
     This is a sequence of file names, each referring to a file created
3210
     by `gcj-dbtool'.  These files will be used by `libgcj' to find
3211
     shared libraries corresponding to classes that are loaded from
3212
     bytecode.  `libgcj' often has a built-in default database; it can
3213
     be queried using `gcj-dbtool -p'.
3214
 
3215
 
3216

3217
File: gcj.info,  Node: Resources,  Next: Index,  Prev: System properties,  Up: Top
3218
 
3219
14 Resources
3220
************
3221
 
3222
While writing `gcj' and `libgcj' we have, of course, relied heavily on
3223
documentation from Sun Microsystems.  In particular we have used The
3224
Java Language Specification (both first and second editions), the Java
3225
Class Libraries (volumes one and two), and the Java Virtual Machine
3226
Specification.  In addition we've used the online documentation at
3227
`http://java.sun.com/'.
3228
 
3229
   The current `gcj' home page is `http://gcc.gnu.org/java/'.
3230
 
3231
   For more information on gcc, see `http://gcc.gnu.org/'.
3232
 
3233
   Some `libgcj' testing is done using the Mauve test suite.  This is a
3234
free software Java class library test suite which is being written
3235
because the JCK is not free.  See `http://sources.redhat.com/mauve/'
3236
for more information.
3237
 
3238

3239
File: gcj.info,  Node: Index,  Prev: Resources,  Up: Top
3240
 
3241
Index
3242
*****
3243
 
3244
 
3245
* Menu:
3246
3247
* class path:                            Input Options.        (line  6)
3248
* class$:                                Reference types.      (line 20)
3249
* elements on template:         Arrays.               (line 46)
3250
* FDL, GNU Free Documentation License:   GNU Free Documentation License.
3251
                                                               (line  6)
3252
* GCJ_PROPERTIES:                        Extensions.           (line 48)
3253
* jclass:                                Reference types.      (line 16)
3254
* jobject:                               Reference types.      (line 16)
3255
* jstring:                               Reference types.      (line 16)
3256
* JvAllocBytes:                          Mixing with C++.      (line 99)
3257
* JvAttachCurrentThread:                 Invocation.           (line 55)
3258
* JvCreateJavaVM:                        Invocation.           (line 11)
3259
* JvDetachCurrentThread:                 Invocation.           (line 68)
3260
* JvFree:                                Memory allocation.    (line 19)
3261
* JvGetArrayLength:                      Arrays.               (line 86)
3262
* JvGetStringChars:                      Strings.              (line 25)
3263
* JvGetStringUTFLength:                  Strings.              (line 29)
3264
* JvGetStringUTFRegion:                  Strings.              (line 34)
3265
* JvMalloc:                              Memory allocation.    (line 11)
3266
* JvNewBooleanArray:                     Arrays.               (line 83)
3267
* JvNewObjectArray:                      Arrays.               (line 57)
3268
* JvNewString:                           Strings.              (line 11)
3269
* JvNewStringLatin1:                     Strings.              (line 15)
3270
 
3271
 
3272
* JvRealloc:                             Memory allocation.    (line 15)
3273
3274
3275

3276
Tag Table:
3277
Node: Top2837
3278
Node: Copying4159
3279
Node: GNU Free Documentation License23354
3280
Node: Invoking gcj45766
3281
Node: Input and output files46465
3282
Node: Input Options47991
3283
Node: Encodings51139
3284
Node: Warnings52345
3285
Node: Linking53458
3286
Node: Code Generation55691
3287
Node: Configure-time Options61160
3288
Node: Compatibility62583
3289
Node: Limitations63063
3290
Node: Extensions64645
3291
Node: Invoking gcjh67243
3292
Node: Invoking gjnih69598
3293
Node: Invoking jv-scan71786
3294
Node: Invoking jcf-dump72828
3295
Node: Invoking gij73776
3296
Node: Invoking gcj-dbtool77027
3297
Node: Invoking jv-convert79493
3298
Node: Invoking grmic80572
3299
Node: Invoking grmiregistry81962
3300
Node: About CNI82375
3301
Node: Basic concepts83817
3302
Node: Packages86713
3303
Node: Primitive types89041
3304
Node: Reference types90719
3305
Node: Interfaces91808
3306
Node: Objects and Classes92719
3307
Node: Class Initialization94914
3308
Node: Object allocation97256
3309
Node: Memory allocation98046
3310
Node: Arrays98678
3311
Node: Methods101489
3312
Node: Strings104310
3313
Node: Mixing with C++105794
3314
Node: Exception Handling109265
3315
Node: Synchronization110899
3316
Node: Invocation112889
3317
Node: Reflection117814
3318
Node: System properties118275
3319
Node: Standard Properties119152
3320
Node: GNU Classpath Properties123584
3321
Node: libgcj Runtime Properties124631
3322
Node: Resources128082

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.