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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [doc/] [gcj.info] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
This is doc/gcj.info, produced by makeinfo version 4.8 from
2
/scratch/mitchell/gcc-releases/gcc-4.2.2/gcc-4.2.2/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 Software development
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
`-static-libgcj'
1147
     This option causes linking to be done against a static version of
1148
     the libgcj runtime library.  This option is only available if
1149
     corresponding linker support exists.
1150
 
1151
     *Caution:* Static linking of libgcj may cause essential parts of
1152
     libgcj to be omitted.  Some parts of libgcj use reflection to load
1153
     classes at runtime.  Since the linker does not see these
1154
     references at link time, it can omit the referred to classes.  The
1155
     result is usually (but not always) a `ClassNotFoundException'
1156
     being thrown at runtime. Caution must be used when using this
1157
     option.  For more details see:
1158
     `http://gcc.gnu.org/wiki/Statically%20linking%20libgcj'
1159
 
1160

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

1298
File: gcj.info,  Node: Configure-time Options,  Prev: Code Generation,  Up: Invoking gcj
1299
 
1300
1.7 Configure-time Options
1301
==========================
1302
 
1303
Some `gcj' code generations options affect the resulting ABI, and so
1304
can only be meaningfully given when `libgcj', the runtime package, is
1305
configured.  `libgcj' puts the appropriate options from this group into
1306
a `spec' file which is read by `gcj'.  These options are listed here
1307
for completeness; if you are using `libgcj' then you won't want to
1308
touch these options.
1309
 
1310
`-fuse-boehm-gc'
1311
     This enables the use of the Boehm GC bitmap marking code.  In
1312
     particular this causes `gcj' to put an object marking descriptor
1313
     into each vtable.
1314
 
1315
`-fhash-synchronization'
1316
     By default, synchronization data (the data used for `synchronize',
1317
     `wait', and `notify') is pointed to by a word in each object.
1318
     With this option `gcj' assumes that this information is stored in a
1319
     hash table and not in the object itself.
1320
 
1321
`-fuse-divide-subroutine'
1322
     On some systems, a library routine is called to perform integer
1323
     division.  This is required to get exception handling correct when
1324
     dividing by zero.
1325
 
1326
`-fcheck-references'
1327
     On some systems it's necessary to insert inline checks whenever
1328
     accessing an object via a reference.  On other systems you won't
1329
     need this because null pointer accesses are caught automatically
1330
     by the processor.
1331
 
1332

1333
File: gcj.info,  Node: Compatibility,  Next: Invoking gcjh,  Prev: Invoking gcj,  Up: Top
1334
 
1335
2 Compatibility with the Java Platform
1336
**************************************
1337
 
1338
As we believe it is important that the Java platform not be fragmented,
1339
`gcj' and `libgcj' try to conform to the relevant Java specifications.
1340
However, limited manpower and incomplete and unclear documentation work
1341
against us.  So, there are caveats to using `gcj'.
1342
 
1343
* Menu:
1344
 
1345
* Limitations::
1346
* Extensions::
1347
 
1348

1349
File: gcj.info,  Node: Limitations,  Next: Extensions,  Up: Compatibility
1350
 
1351
2.1 Standard features not yet supported
1352
=======================================
1353
 
1354
This list of compatibility issues is by no means complete.
1355
 
1356
   * `gcj' implements the JDK 1.2 language.  It supports inner classes
1357
     and the new 1.4 `assert' keyword.  It does not yet support the
1358
     Java 2 `strictfp' keyword (it recognizes the keyword but ignores
1359
     it).
1360
 
1361
   * `libgcj' is largely compatible with the JDK 1.2 libraries.
1362
     However, `libgcj' is missing many packages, most notably
1363
     `java.awt'.  There are also individual missing classes and methods.
1364
     We currently do not have a list showing differences between
1365
     `libgcj' and the Java 2 platform.
1366
 
1367
   * Sometimes the `libgcj' implementation of a method or class differs
1368
     from the JDK implementation.  This is not always a bug.  Still, if
1369
     it affects you, it probably makes sense to report it so that we
1370
     can discuss the appropriate response.
1371
 
1372
   * `gcj' does not currently allow for piecemeal replacement of
1373
     components within `libgcj'. Unfortunately, programmers often want
1374
     to use newer versions of certain packages, such as those provided
1375
     by the Apache Software Foundation's Jakarta project.  This has
1376
     forced us to place the `org.w3c.dom' and `org.xml.sax' packages
1377
     into their own libraries, separate from `libgcj'.  If you intend to
1378
     use these classes, you must link them explicitly with
1379
     `-l-org-w3c-dom' and `-l-org-xml-sax'.  Future versions of `gcj'
1380
     may not have this restriction.
1381
 
1382

1383
File: gcj.info,  Node: Extensions,  Prev: Limitations,  Up: Compatibility
1384
 
1385
2.2 Extra features unique to gcj
1386
================================
1387
 
1388
The main feature of `gcj' is that it can compile programs written in
1389
the Java programming language to native code.  Most extensions that
1390
have been added are to facilitate this functionality.
1391
 
1392
   * `gcj' makes it easy and efficient to mix code written in Java and
1393
     C++.  *Note About CNI::, for more info on how to use this in your
1394
     programs.
1395
 
1396
   * When you compile your classes into a shared library using
1397
     `-findirect-dispatch' then add them to the system-wide classmap.db
1398
     file using `gcj-dbtool', they will be automatically loaded by the
1399
     `libgcj' system classloader.  This is the new, preferred
1400
     classname-to-library resolution mechanism.  *Note Invoking
1401
     gcj-dbtool::, for more information on using the classmap database.
1402
 
1403
   * The old classname-to-library lookup mechanism is still supported
1404
     through the `gnu.gcj.runtime.VMClassLoader.library_control'
1405
     property, but it is deprecated and will likely be removed in some
1406
     future release.  When trying to load a class `gnu.pkg.SomeClass'
1407
     the system classloader will first try to load the shared library
1408
     `lib-gnu-pkg-SomeClass.so', if that fails to load the class then
1409
     it will try to load `lib-gnu-pkg.so' and finally when the class is
1410
     still not loaded it will try to load `lib-gnu.so'.  Note that all
1411
     `.'s will be transformed into `-'s and that searching for inner
1412
     classes starts with their outermost outer class.  If the class
1413
     cannot be found this way the system classloader tries to use the
1414
     `libgcj' bytecode interpreter to load the class from the standard
1415
     classpath.  This process can be controlled to some degree via the
1416
     `gnu.gcj.runtime.VMClassLoader.library_control' property; *Note
1417
     libgcj Runtime Properties::.
1418
 
1419
   * `libgcj' includes a special `gcjlib' URL type.  A URL of this form
1420
     is like a `jar' URL, and looks like
1421
     `gcjlib:/path/to/shared/library.so!/path/to/resource'.  An access
1422
     to one of these URLs causes the shared library to be `dlopen()'d,
1423
     and then the resource is looked for in that library.  These URLs
1424
     are most useful when used in conjunction with
1425
     `java.net.URLClassLoader'.  Note that, due to implementation
1426
     limitations, currently any such URL can be accessed by only one
1427
     class loader, and libraries are never unloaded.  This means some
1428
     care must be exercised to make sure that a `gcjlib' URL is not
1429
     accessed by more than one class loader at once.  In a future
1430
     release this limitation will be lifted, and such libraries will be
1431
     mapped privately.
1432
 
1433
   * A program compiled by `gcj' will examine the `GCJ_PROPERTIES'
1434
     environment variable and change its behavior in some ways.  In
1435
     particular `GCJ_PROPERTIES' holds a list of assignments to global
1436
     properties, such as would be set with the `-D' option to `java'.
1437
     For instance, `java.compiler=gcj' is a valid (but currently
1438
     meaningless) setting.
1439
 
1440
 
1441

1442
File: gcj.info,  Node: Invoking gcjh,  Next: Invoking gjnih,  Prev: Compatibility,  Up: Top
1443
 
1444
3 Invoking gcjh
1445
***************
1446
 
1447
The `gcjh' program is used to generate header files from class files.
1448
It can generate both CNI and JNI header files, as well as stub
1449
implementation files which can be used as a basis for implementing the
1450
required native methods.
1451
 
1452
`-stubs'
1453
     This causes `gcjh' to generate stub files instead of header files.
1454
     By default the stub file will be named after the class, with a
1455
     suffix of `.cc'.  In JNI mode, the default output file will have
1456
     the suffix `.c'.
1457
 
1458
`-jni'
1459
     This tells `gcjh' to generate a JNI header or stub.  By default,
1460
     CNI headers are generated.
1461
 
1462
`-force'
1463
     This option forces `gcjh' to write the output file.
1464
 
1465
`-old'
1466
     This option is accepted but ignored for compatibility.
1467
 
1468
`-trace'
1469
     This option is accepted but ignored for compatibility.
1470
 
1471
`-J OPTION'
1472
     This option is accepted but ignored for compatibility.
1473
 
1474
`-add TEXT'
1475
     Inserts TEXT into the class body.  This is ignored in JNI mode.
1476
 
1477
`-append TEXT'
1478
     Inserts TEXT into the header file after the class declaration.
1479
     This is ignored in JNI mode.
1480
 
1481
`-friend TEXT'
1482
     Inserts TEXT into the class as a `friend' declaration.  This is
1483
     ignored in JNI mode.
1484
 
1485
`-prepend TEXT'
1486
     Inserts TEXT into the header file before the class declaration.
1487
     This is ignored in JNI mode.
1488
 
1489
`--classpath=PATH'
1490
`--CLASSPATH=PATH'
1491
`--bootclasspath=PATH'
1492
`-IDIRECTORY'
1493
`-d DIRECTORY'
1494
`-o FILE'
1495
     These options are all identical to the corresponding `gcj' options.
1496
 
1497
`-o FILE'
1498
     Sets the output file name.  This cannot be used if there is more
1499
     than one class on the command line.
1500
 
1501
`-td DIRECTORY'
1502
     Sets the name of the directory to use for temporary files.
1503
 
1504
`-M'
1505
     Print all dependencies to stdout; suppress ordinary output.
1506
 
1507
`-MM'
1508
     Print non-system dependencies to stdout; suppress ordinary output.
1509
 
1510
`-MD'
1511
     Print all dependencies to stdout.
1512
 
1513
`-MMD'
1514
     Print non-system dependencies to stdout.
1515
 
1516
`--help'
1517
     Print help about `gcjh' and exit.  No further processing is done.
1518
 
1519
`--version'
1520
     Print version information for `gcjh' and exit.  No further
1521
     processing is done.
1522
 
1523
`-v, --verbose'
1524
     Print extra information while running.
1525
 
1526
   All remaining options are considered to be names of classes.
1527
 
1528

1529
File: gcj.info,  Node: Invoking gjnih,  Next: Invoking jv-scan,  Prev: Invoking gcjh,  Up: Top
1530
 
1531
4 Invoking gjnih
1532
****************
1533
 
1534
The `gjnih' program is used to generate JNI header files from class
1535
files.  Running it is equivalent to running `gcjh -jni'.
1536
 
1537
`-stubs'
1538
     This causes `gjnih' to generate stub files instead of header files.
1539
     By default the stub file will be named after the class, with a
1540
     suffix of `.c'.
1541
 
1542
`-jni'
1543
     This option specifies the default behavior which is to generate a
1544
     JNI header or stub.
1545
 
1546
`-force'
1547
     This option forces `gjnih' to write the output file.
1548
 
1549
`-old'
1550
     This option is accepted but ignored for compatibility.
1551
 
1552
`-trace'
1553
     This option is accepted but ignored for compatibility.
1554
 
1555
`-J OPTION'
1556
     This option is accepted but ignored for compatibility.
1557
 
1558
`-add TEXT'
1559
     Inserts TEXT into the class body.  This is ignored in by `gjnih'.
1560
 
1561
`-append TEXT'
1562
     Inserts TEXT into the header file after the class declaration.
1563
     This is ignored in by `gjnih'.
1564
 
1565
`-friend TEXT'
1566
     Inserts TEXT into the class as a `friend' declaration.  This is
1567
     ignored by `gjnih'.
1568
 
1569
`-prepend TEXT'
1570
     Inserts TEXT into the header file before the class declaration.
1571
     This is ignored in by `gjnih'.
1572
 
1573
`--classpath=PATH'
1574
`--CLASSPATH=PATH'
1575
`--bootclasspath=PATH'
1576
`-IDIRECTORY'
1577
`-d DIRECTORY'
1578
`-o FILE'
1579
     These options are all identical to the corresponding `gcj' options.
1580
 
1581
`-o FILE'
1582
     Sets the output file name.  This cannot be used if there is more
1583
     than one class on the command line.
1584
 
1585
`-td DIRECTORY'
1586
     Sets the name of the directory to use for temporary files.
1587
 
1588
`-M'
1589
     Print all dependencies to stdout; suppress ordinary output.
1590
 
1591
`-MM'
1592
     Print non-system dependencies to stdout; suppress ordinary output.
1593
 
1594
`-MD'
1595
     Print all dependencies to stdout.
1596
 
1597
`-MMD'
1598
     Print non-system dependencies to stdout.
1599
 
1600
`--help'
1601
     Print help about `gjnih' and exit.  No further processing is done.
1602
 
1603
`--version'
1604
     Print version information for `gjnih' and exit.  No further
1605
     processing is done.
1606
 
1607
`-v, --verbose'
1608
     Print extra information while running.
1609
 
1610
   All remaining options are considered to be names of classes.
1611
 
1612

1613
File: gcj.info,  Node: Invoking jv-scan,  Next: Invoking jcf-dump,  Prev: Invoking gjnih,  Up: Top
1614
 
1615
5 Invoking jv-scan
1616
******************
1617
 
1618
The `jv-scan' program can be used to print information about a Java
1619
source file (`.java' file).
1620
 
1621
`--no-assert'
1622
     Don't recognize the `assert' keyword, for backwards compatibility
1623
     with older versions of the language specification.
1624
 
1625
`--complexity'
1626
     This prints a complexity measure, related to cyclomatic
1627
     complexity, for each input file.
1628
 
1629
`--encoding=NAME'
1630
     This works like the corresponding `gcj' option.
1631
 
1632
`--print-main'
1633
     This prints the name of the class in this file containing a `main'
1634
     method.
1635
 
1636
`--list-class'
1637
     This lists the names of all classes defined in the input files.
1638
 
1639
`--list-filename'
1640
     If `--list-class' is given, this option causes `jv-scan' to also
1641
     print the name of the file in which each class was found.
1642
 
1643
`-o FILE'
1644
     Print output to the named file.
1645
 
1646
`--help'
1647
     Print help, then exit.
1648
 
1649
`--version'
1650
     Print version number, then exit.
1651
 
1652

1653
File: gcj.info,  Node: Invoking jcf-dump,  Next: Invoking gij,  Prev: Invoking jv-scan,  Up: Top
1654
 
1655
6 Invoking jcf-dump
1656
*******************
1657
 
1658
This is a class file examiner, similar to `javap'.  It will print
1659
information about a number of classes, which are specified by class name
1660
or file name.
1661
 
1662
`-c'
1663
     Disassemble method bodies.  By default method bodies are not
1664
     printed.
1665
 
1666
`--print-constants'
1667
     Print the constant pool.  When printing a reference to a constant
1668
     also print its index in the constant pool.
1669
 
1670
`--javap'
1671
     Generate output in `javap' format.  The implementation of this
1672
     feature is very incomplete.
1673
 
1674
`--classpath=PATH'
1675
`--CLASSPATH=PATH'
1676
`-IDIRECTORY'
1677
`-o FILE'
1678
     These options as the same as the corresponding `gcj' options.
1679
 
1680
`--help'
1681
     Print help, then exit.
1682
 
1683
`--version'
1684
     Print version number, then exit.
1685
 
1686
`-v, --verbose'
1687
     Print extra information while running.  Implies
1688
     `--print-constants'.
1689
 
1690

1691
File: gcj.info,  Node: Invoking gij,  Next: Invoking gcj-dbtool,  Prev: Invoking jcf-dump,  Up: Top
1692
 
1693
7 Invoking gij
1694
**************
1695
 
1696
`gij' is a Java bytecode interpreter included with `libgcj'.  `gij' is
1697
not available on every platform; porting it requires a small amount of
1698
assembly programming which has not been done for all the targets
1699
supported by `gcj'.
1700
 
1701
   The primary argument to `gij' is the name of a class or, with
1702
`-jar', a jar file.  Options before this argument are interpreted by
1703
`gij'; remaining options are passed to the interpreted program.
1704
 
1705
   If a class name is specified and this class does not have a `main'
1706
method with the appropriate signature (a `static void' method with a
1707
`String[]' as its sole argument), then `gij' will print an error and
1708
exit.
1709
 
1710
   If a jar file is specified then `gij' will use information in it to
1711
determine which class' `main' method will be invoked.
1712
 
1713
   `gij' will invoke the `main' method with all the remaining
1714
command-line options.
1715
 
1716
   Note that `gij' is not limited to interpreting code.  Because
1717
`libgcj' includes a class loader which can dynamically load shared
1718
objects, it is possible to give `gij' the name of a class which has
1719
been compiled and put into a shared library on the class path.
1720
 
1721
`-cp PATH'
1722
`-classpath PATH'
1723
     Set the initial class path.  The class path is used for finding
1724
     class and resource files.  If specified, this option overrides the
1725
     `CLASSPATH' environment variable.  Note that this option is
1726
     ignored if `-jar' is used.
1727
 
1728
`-DNAME[=VALUE]'
1729
     This defines a system property named NAME with value VALUE.  If
1730
     VALUE is not specified then it defaults to the empty string.
1731
     These system properties are initialized at the program's startup
1732
     and can be retrieved at runtime using the
1733
     `java.lang.System.getProperty' method.
1734
 
1735
`-ms=NUMBER'
1736
     Equivalent to `-Xms'.
1737
 
1738
`-mx=NUMBER'
1739
     Equivalent to `-Xmx'.
1740
 
1741
`-noverify'
1742
     Do not verify compliance of bytecode with the VM specification. In
1743
     addition, this option disables type verification which is
1744
     otherwise performed on BC-ABI compiled code.
1745
 
1746
`-X'
1747
`-XARGUMENT'
1748
     Supplying `-X' by itself will cause `gij' to list all the
1749
     supported `-X' options.  Currently these options are supported:
1750
 
1751
    `-XmsSIZE'
1752
          Set the initial heap size.
1753
 
1754
    `-XmxSIZE'
1755
          Set the maximum heap size.
1756
 
1757
    `-XssSIZE'
1758
          Set the thread stack size.
1759
 
1760
     Unrecognized `-X' options are ignored, for compatibility with
1761
     other runtimes.
1762
 
1763
`-jar'
1764
     This indicates that the name passed to `gij' should be interpreted
1765
     as the name of a jar file, not a class.
1766
 
1767
`--help'
1768
`-?'
1769
     Print help, then exit.
1770
 
1771
`--showversion'
1772
     Print version number and continue.
1773
 
1774
`--fullversion'
1775
     Print detailed version information, then exit.
1776
 
1777
`--version'
1778
     Print version number, then exit.
1779
 
1780
`-verbose'
1781
`-verbose:class'
1782
     Each time a class is initialized, print a short message on
1783
     standard error.
1784
 
1785
   `gij' also recognizes and ignores the following options, for
1786
compatibility with existing application launch scripts: `-client',
1787
`-server', `-hotspot', `-jrockit', `-agentlib', `-agentpath', `-debug',
1788
`-d32', `-d64', `-javaagent', `-noclassgc', `-verify', and
1789
`-verifyremote'.
1790
 
1791

1792
File: gcj.info,  Node: Invoking gcj-dbtool,  Next: Invoking jv-convert,  Prev: Invoking gij,  Up: Top
1793
 
1794
8 Invoking gcj-dbtool.
1795
**********************
1796
 
1797
`gcj-dbtool' is a tool for creating and manipulating class file mapping
1798
databases.  `libgcj' can use these databases to find a shared library
1799
corresponding to the bytecode representation of a class.  This
1800
functionality is useful for ahead-of-time compilation of a program that
1801
has no knowledge of `gcj'.
1802
 
1803
   `gcj-dbtool' works best if all the jar files added to it are
1804
compiled using `-findirect-dispatch'.
1805
 
1806
   Note that `gcj-dbtool' is currently available as "preview
1807
technology".  We believe it is a reasonable way to allow
1808
application-transparent ahead-of-time compilation, but this is an
1809
unexplored area.  We welcome your comments.
1810
 
1811
`-n DBFILE [SIZE]'
1812
     This creates a new database.  Currently, databases cannot be
1813
     resized; you can choose a larger initial size if desired.  The
1814
     default size is 32,749.
1815
 
1816
`-a DBFILE JARFILE LIB'
1817
`-f DBFILE JARFILE LIB'
1818
     This adds a jar file to the database.  For each class file in the
1819
     jar, a cryptographic signature of the bytecode representation of
1820
     the class is recorded in the database.  At runtime, a class is
1821
     looked up by its signature and the compiled form of the class is
1822
     looked for in the corresponding shared library.  The `-a' option
1823
     will verify that LIB exists before adding it to the database; `-f'
1824
     skips this check.
1825
 
1826
`[`-'][`-0'] -m DBFILE DBFILE,[DBFILE]'
1827
     Merge a number of databases.  The output database overwrites any
1828
     existing database.  To add databases into an existing database,
1829
     include the destination in the list of sources.
1830
 
1831
     If `-' or `-0' are used, the list of files to read is taken from
1832
     standard input instead of the command line.  For `-0', Input
1833
     filenames are terminated by a null character instead of by
1834
     whitespace.  Useful when arguments might contain white space.  The
1835
     GNU find -print0 option produces input suitable for this mode.
1836
 
1837
`-t DBFILE'
1838
     Test a database.
1839
 
1840
`-l DBFILE'
1841
     List the contents of a database.
1842
 
1843
`-p'
1844
     Print the name of the default database.  If there is no default
1845
     database, this prints a blank line.  If LIBDIR is specified, use
1846
     it instead of the default library directory component of the
1847
     database name.
1848
 
1849
`--help'
1850
     Print a help message, then exit.
1851
 
1852
`--version'
1853
`-v'
1854
     Print version information, then exit.
1855
 
1856
 
1857

1858
File: gcj.info,  Node: Invoking jv-convert,  Next: Invoking grmic,  Prev: Invoking gcj-dbtool,  Up: Top
1859
 
1860
9 Invoking jv-convert
1861
*********************
1862
 
1863
`jv-convert' [`OPTION'] ... [INPUTFILE [OUTPUTFILE]]
1864
 
1865
   `jv-convert' is a utility included with `libgcj' which converts a
1866
file from one encoding to another.  It is similar to the Unix `iconv'
1867
utility.
1868
 
1869
   The encodings supported by `jv-convert' are platform-dependent.
1870
Currently there is no way to get a list of all supported encodings.
1871
 
1872
`--encoding NAME'
1873
`--from NAME'
1874
     Use NAME as the input encoding.  The default is the current
1875
     locale's encoding.
1876
 
1877
`--to NAME'
1878
     Use NAME as the output encoding.  The default is the `JavaSrc'
1879
     encoding; this is ASCII with `\u' escapes for non-ASCII characters.
1880
 
1881
`-i FILE'
1882
     Read from FILE.  The default is to read from standard input.
1883
 
1884
`-o FILE'
1885
     Write to FILE.  The default is to write to standard output.
1886
 
1887
`--reverse'
1888
     Swap the input and output encodings.
1889
 
1890
`--help'
1891
     Print a help message, then exit.
1892
 
1893
`--version'
1894
     Print version information, then exit.
1895
 
1896

1897
File: gcj.info,  Node: Invoking grmic,  Next: Invoking grmiregistry,  Prev: Invoking jv-convert,  Up: Top
1898
 
1899
10 Invoking grmic
1900
*****************
1901
 
1902
`grmic' [`OPTION'] ... CLASS ...
1903
 
1904
   `grmic' is a utility included with `libgcj' which generates stubs
1905
for remote objects.
1906
 
1907
   Note that this program isn't yet fully compatible with the JDK
1908
`grmic'.  Some options, such as `-classpath', are recognized but
1909
currently ignored.  We have left these options undocumented for now.
1910
 
1911
   Long options can also be given with a GNU-style leading `--'.  For
1912
instance, `--help' is accepted.
1913
 
1914
`-keep'
1915
`-keepgenerated'
1916
     By default, `grmic' deletes intermediate files.  Either of these
1917
     options causes it not to delete such files.
1918
 
1919
`-v1.1'
1920
     Cause `grmic' to create stubs and skeletons for the 1.1 protocol
1921
     version.
1922
 
1923
`-vcompat'
1924
     Cause `grmic' to create stubs and skeletons compatible with both
1925
     the 1.1 and 1.2 protocol versions.  This is the default.
1926
 
1927
`-v1.2'
1928
     Cause `grmic' to create stubs and skeletons for the 1.2 protocol
1929
     version.
1930
 
1931
`-nocompile'
1932
     Don't compile the generated files.
1933
 
1934
`-verbose'
1935
     Print information about what `grmic' is doing.
1936
 
1937
`-d DIRECTORY'
1938
     Put output files in DIRECTORY.  By default the files are put in
1939
     the current working directory.
1940
 
1941
`-help'
1942
     Print a help message, then exit.
1943
 
1944
`-version'
1945
     Print version information, then exit.
1946
 
1947

1948
File: gcj.info,  Node: Invoking grmiregistry,  Next: About CNI,  Prev: Invoking grmic,  Up: Top
1949
 
1950
11 Invoking grmiregistry
1951
************************
1952
 
1953
`grmic' [`OPTION'] ... [PORT]
1954
 
1955
   `grmiregistry' starts a remote object registry on the current host.
1956
If no port number is specified, then port 1099 is used.
1957
 
1958
`--help'
1959
     Print a help message, then exit.
1960
 
1961
`--version'
1962
     Print version information, then exit.
1963
 
1964

1965
File: gcj.info,  Node: About CNI,  Next: System properties,  Prev: Invoking grmiregistry,  Up: Top
1966
 
1967
12 About CNI
1968
************
1969
 
1970
This documents CNI, the Compiled Native Interface, which is is a
1971
convenient way to write Java native methods using C++.  This is a more
1972
efficient, more convenient, but less portable alternative to the
1973
standard JNI (Java Native Interface).
1974
 
1975
* Menu:
1976
 
1977
* Basic concepts::              Introduction to using CNI.
1978
* Packages::                    How packages are mapped to C++.
1979
* Primitive types::             Handling primitive Java types in C++.
1980
* Reference types::             Handling Java reference types in C++.
1981
* Interfaces::                  How Java interfaces map to C++.
1982
* Objects and Classes::         C++ and Java classes.
1983
* Class Initialization::        How objects are initialized.
1984
* Object allocation::           How to create Java objects in C++.
1985
* Memory allocation::           How to allocate and free memory.
1986
* Arrays::                      Dealing with Java arrays in C++.
1987
* Methods::                     Java methods in C++.
1988
* Strings::                     Information about Java Strings.
1989
* Mixing with C++::             How CNI can interoperate with C++.
1990
* Exception Handling::          How exceptions are handled.
1991
* Synchronization::             Synchronizing between Java and C++.
1992
* Invocation::                  Starting the Java runtime from C++.
1993
* Reflection::                  Using reflection from C++.
1994
 
1995

1996
File: gcj.info,  Node: Basic concepts,  Next: Packages,  Up: About CNI
1997
 
1998
12.1 Basic concepts
1999
===================
2000
 
2001
In terms of languages features, Java is mostly a subset of C++.  Java
2002
has a few important extensions, plus a powerful standard class library,
2003
but on the whole that does not change the basic similarity.  Java is a
2004
hybrid object-oriented language, with a few native types, in addition
2005
to class types.  It is class-based, where a class may have static as
2006
well as per-object fields, and static as well as instance methods.
2007
Non-static methods may be virtual, and may be overloaded.  Overloading
2008
is resolved at compile time by matching the actual argument types
2009
against the parameter types.  Virtual methods are implemented using
2010
indirect calls through a dispatch table (virtual function table).
2011
Objects are allocated on the heap, and initialized using a constructor
2012
method.  Classes are organized in a package hierarchy.
2013
 
2014
   All of the listed attributes are also true of C++, though C++ has
2015
extra features (for example in C++ objects may be allocated not just on
2016
the heap, but also statically or in a local stack frame).  Because
2017
`gcj' uses the same compiler technology as G++ (the GNU C++ compiler),
2018
it is possible to make the intersection of the two languages use the
2019
same ABI (object representation and calling conventions).  The key idea
2020
in CNI is that Java objects are C++ objects, and all Java classes are
2021
C++ classes (but not the other way around).  So the most important task
2022
in integrating Java and C++ is to remove gratuitous incompatibilities.
2023
 
2024
   You write CNI code as a regular C++ source file.  (You do have to use
2025
a Java/CNI-aware C++ compiler, specifically a recent version of G++.)
2026
 
2027
A CNI C++ source file must have:
2028
 
2029
     #include 
2030
 
2031
and then must include one header file for each Java class it uses, e.g.:
2032
 
2033
     #include 
2034
     #include 
2035
     #include 
2036
 
2037
These header files are automatically generated by `gcjh'.
2038
 
2039
   CNI provides some functions and macros to make using Java objects and
2040
primitive types from C++ easier.  In general, these CNI functions and
2041
macros start with the `Jv' prefix, for example the function
2042
`JvNewObjectArray'.  This convention is used to avoid conflicts with
2043
other libraries.  Internal functions in CNI start with the prefix
2044
`_Jv_'.  You should not call these; if you find a need to, let us know
2045
and we will try to come up with an alternate solution.
2046
 
2047
12.1.1 Limitations
2048
------------------
2049
 
2050
Whilst a Java class is just a C++ class that doesn't mean that you are
2051
freed from the shackles of Java, a CNI C++ class must adhere to the
2052
rules of the Java programming language.
2053
 
2054
   For example: it is not possible to declare a method in a CNI class
2055
that will take a C string (`char*') as an argument, or to declare a
2056
member variable of some non-Java datatype.
2057
 
2058

2059
File: gcj.info,  Node: Packages,  Next: Primitive types,  Prev: Basic concepts,  Up: About CNI
2060
 
2061
12.2 Packages
2062
=============
2063
 
2064
The only global names in Java are class names, and packages.  A
2065
"package" can contain zero or more classes, and also zero or more
2066
sub-packages.  Every class belongs to either an unnamed package or a
2067
package that has a hierarchical and globally unique name.
2068
 
2069
   A Java package is mapped to a C++ "namespace".  The Java class
2070
`java.lang.String' is in the package `java.lang', which is a
2071
sub-package of `java'.  The C++ equivalent is the class
2072
`java::lang::String', which is in the namespace `java::lang' which is
2073
in the namespace `java'.
2074
 
2075
Here is how you could express this:
2076
 
2077
     (// Declare the class(es), possibly in a header file:
2078
     namespace java {
2079
       namespace lang {
2080
         class Object;
2081
         class String;
2082
         ...
2083
       }
2084
     }
2085
 
2086
     class java::lang::String : public java::lang::Object
2087
     {
2088
       ...
2089
     };
2090
 
2091
The `gcjh' tool automatically generates the necessary namespace
2092
declarations.
2093
 
2094
12.2.1 Leaving out package names
2095
--------------------------------
2096
 
2097
Always using the fully-qualified name of a java class can be tiresomely
2098
verbose.  Using the full qualified name also ties the code to a single
2099
package making code changes necessary should the class move from one
2100
package to another.  The Java `package' declaration specifies that the
2101
following class declarations are in the named package, without having
2102
to explicitly name the full package qualifiers.  The `package'
2103
declaration can be followed by zero or more `import' declarations, which
2104
allows either a single class or all the classes in a package to be
2105
named by a simple identifier.  C++ provides something similar with the
2106
`using' declaration and directive.
2107
 
2108
In Java:
2109
 
2110
     import PACKAGE-NAME.CLASS-NAME;
2111
 
2112
allows the program text to refer to CLASS-NAME as a shorthand for the
2113
fully qualified name: `PACKAGE-NAME.CLASS-NAME'.
2114
 
2115
To achieve the same effect C++, you have to do this:
2116
 
2117
     using PACKAGE-NAME::CLASS-NAME;
2118
 
2119
Java can also cause imports on demand, like this:
2120
 
2121
     import PACKAGE-NAME.*;
2122
 
2123
Doing this allows any class from the package PACKAGE-NAME to be
2124
referred to only by its class-name within the program text.
2125
 
2126
The same effect can be achieved in C++ like this:
2127
 
2128
     using namespace PACKAGE-NAME;
2129
 
2130

2131
File: gcj.info,  Node: Primitive types,  Next: Reference types,  Prev: Packages,  Up: About CNI
2132
 
2133
12.3 Primitive types
2134
====================
2135
 
2136
Java provides 8 "primitives" types which represent integers, floats,
2137
characters and booleans (and also the void type).  C++ has its own very
2138
similar concrete types.  Such types in C++ however are not always
2139
implemented in the same way (an int might be 16, 32 or 64 bits for
2140
example) so CNI provides a special C++ type for each primitive Java
2141
type:
2142
 
2143
*Java type*    *C/C++ typename*   *Description*
2144
`char'         `jchar'            16 bit Unicode character
2145
`boolean'      `jboolean'         logical (true or false) values
2146
`byte'         `jbyte'            8-bit signed integer
2147
`short'        `jshort'           16 bit signed integer
2148
`int'          `jint'             32 bit signed integer
2149
`long'         `jlong'            64 bit signed integer
2150
`float'        `jfloat'           32 bit IEEE floating point number
2151
`double'       `jdouble'          64 bit IEEE floating point number
2152
`void'         `void'             no value
2153
 
2154
   When referring to a Java type You should always use these C++
2155
typenames (e.g.: `jint') to avoid disappointment.
2156
 
2157
12.3.1 Reference types associated with primitive types
2158
------------------------------------------------------
2159
 
2160
In Java each primitive type has an associated reference type, e.g.:
2161
`boolean' has an associated `java.lang.Boolean.TYPE' class.  In order
2162
to make working with such classes easier GCJ provides the macro
2163
`JvPrimClass':
2164
 
2165
 -- macro: JvPrimClass type
2166
     Return a pointer to the `Class' object corresponding to the type
2167
     supplied.
2168
 
2169
          JvPrimClass(void) => java.lang.Void.TYPE
2170
 
2171
 
2172

2173
File: gcj.info,  Node: Reference types,  Next: Interfaces,  Prev: Primitive types,  Up: About CNI
2174
 
2175
12.4 Reference types
2176
====================
2177
 
2178
A Java reference type is treated as a class in C++.  Classes and
2179
interfaces are handled this way.  A Java reference is translated to a
2180
C++ pointer, so for instance a Java `java.lang.String' becomes, in C++,
2181
`java::lang::String *'.
2182
 
2183
   CNI provides a few built-in typedefs for the most common classes:
2184
*Java type*            *C++ typename*     *Description*
2185
`java.lang.Object'     `jobject'          Object type
2186
`java.lang.String'     `jstring'          String type
2187
`java.lang.Class'      `jclass'           Class type
2188
 
2189
   Every Java class or interface has a corresponding `Class' instance.
2190
These can be accessed in CNI via the static `class$' field of a class.
2191
The `class$' field is of type `Class' (and not `Class *'), so you will
2192
typically take the address of it.
2193
 
2194
   Here is how you can refer to the class of `String', which in Java
2195
would be written `String.class':
2196
 
2197
     using namespace java::lang;
2198
     doSomething (&String::class$);
2199
 
2200

2201
File: gcj.info,  Node: Interfaces,  Next: Objects and Classes,  Prev: Reference types,  Up: About CNI
2202
 
2203
12.5 Interfaces
2204
===============
2205
 
2206
A Java class can "implement" zero or more "interfaces", in addition to
2207
inheriting from a single base class.
2208
 
2209
   CNI allows CNI code to implement methods of interfaces.  You can
2210
also call methods through interface references, with some limitations.
2211
 
2212
   CNI doesn't understand interface inheritance at all yet.  So, you
2213
can only call an interface method when the declared type of the field
2214
being called matches the interface which declares that method.  The
2215
workaround is to cast the interface reference to the right
2216
superinterface.
2217
 
2218
   For example if you have:
2219
 
2220
     interface A
2221
     {
2222
       void a();
2223
     }
2224
 
2225
     interface B extends A
2226
     {
2227
       void b();
2228
     }
2229
 
2230
   and declare a variable of type `B' in C++, you can't call `a()'
2231
unless you cast it to an `A' first.
2232
 
2233

2234
File: gcj.info,  Node: Objects and Classes,  Next: Class Initialization,  Prev: Interfaces,  Up: About CNI
2235
 
2236
12.6 Objects and Classes
2237
========================
2238
 
2239
12.6.1 Classes
2240
--------------
2241
 
2242
All Java classes are derived from `java.lang.Object'.  C++ does not
2243
have a unique root class, but we use the C++ class `java::lang::Object'
2244
as the C++ version of the `java.lang.Object' Java class.  All other
2245
Java classes are mapped into corresponding C++ classes derived from
2246
`java::lang::Object'.
2247
 
2248
   Interface inheritance (the `implements' keyword) is currently not
2249
reflected in the C++ mapping.
2250
 
2251
12.6.2 Object fields
2252
--------------------
2253
 
2254
Each object contains an object header, followed by the instance fields
2255
of the class, in order.  The object header consists of a single pointer
2256
to a dispatch or virtual function table.  (There may be extra fields
2257
_in front of_ the object, for example for memory management, but this
2258
is invisible to the application, and the reference to the object points
2259
to the dispatch table pointer.)
2260
 
2261
   The fields are laid out in the same order, alignment, and size as in
2262
C++.  Specifically, 8-bit and 16-bit native types (`byte', `short',
2263
`char', and `boolean') are _not_ widened to 32 bits.  Note that the
2264
Java VM does extend 8-bit and 16-bit types to 32 bits when on the VM
2265
stack or temporary registers.
2266
 
2267
   If you include the `gcjh'-generated header for a class, you can
2268
access fields of Java classes in the _natural_ way.  For example, given
2269
the following Java class:
2270
 
2271
     public class Int
2272
     {
2273
       public int i;
2274
       public Int (int i) { this.i = i; }
2275
       public static Int zero = new Int(0);
2276
     }
2277
 
2278
   you can write:
2279
 
2280
     #include ;
2281
     #include ;
2282
 
2283
     Int*
2284
     mult (Int *p, jint k)
2285
     {
2286
       if (k == 0)
2287
         return Int::zero;  // Static member access.
2288
       return new Int(p->i * k);
2289
     }
2290
 
2291
12.6.3 Access specifiers
2292
------------------------
2293
 
2294
CNI does not strictly enforce the Java access specifiers, because Java
2295
permissions cannot be directly mapped into C++ permission.  Private
2296
Java fields and methods are mapped to private C++ fields and methods,
2297
but other fields and methods are mapped to public fields and methods.
2298
 
2299

2300
File: gcj.info,  Node: Class Initialization,  Next: Object allocation,  Prev: Objects and Classes,  Up: About CNI
2301
 
2302
12.7 Class Initialization
2303
=========================
2304
 
2305
Java requires that each class be automatically initialized at the time
2306
of the first active use.  Initializing a class involves initializing
2307
the static fields, running code in class initializer methods, and
2308
initializing base classes.  There may also be some implementation
2309
specific actions, such as allocating `String' objects corresponding to
2310
string literals in the code.
2311
 
2312
   The GCJ compiler inserts calls to `JvInitClass' at appropriate
2313
places to ensure that a class is initialized when required.  The C++
2314
compiler does not insert these calls automatically--it is the
2315
programmer's responsibility to make sure classes are initialized.
2316
However, this is fairly painless because of the conventions assumed by
2317
the Java system.
2318
 
2319
   First, `libgcj' will make sure a class is initialized before an
2320
instance of that object is created.  This is one of the
2321
responsibilities of the `new' operation.  This is taken care of both in
2322
Java code, and in C++ code.  When G++ sees a `new' of a Java class, it
2323
will call a routine in `libgcj' to allocate the object, and that
2324
routine will take care of initializing the class.  Note however that
2325
this does not happen for Java arrays; you must allocate those using the
2326
appropriate CNI function.  It follows that you can access an instance
2327
field, or call an instance (non-static) method and be safe in the
2328
knowledge that the class and all of its base classes have been
2329
initialized.
2330
 
2331
   Invoking a static method is also safe.  This is because the Java
2332
compiler adds code to the start of a static method to make sure the
2333
class is initialized.  However, the C++ compiler does not add this
2334
extra code.  Hence, if you write a native static method using CNI, you
2335
are responsible for calling `JvInitClass' before doing anything else in
2336
the method (unless you are sure it is safe to leave it out).
2337
 
2338
   Accessing a static field also requires the class of the field to be
2339
initialized.  The Java compiler will generate code to call
2340
`JvInitClass' before getting or setting the field.  However, the C++
2341
compiler will not generate this extra code, so it is your
2342
responsibility to make sure the class is initialized before you access
2343
a static field from C++.
2344
 
2345

2346
File: gcj.info,  Node: Object allocation,  Next: Memory allocation,  Prev: Class Initialization,  Up: About CNI
2347
 
2348
12.8 Object allocation
2349
======================
2350
 
2351
New Java objects are allocated using a "class instance creation
2352
expression", e.g.:
2353
 
2354
     new TYPE ( ... )
2355
 
2356
   The same syntax is used in C++.  The main difference is that C++
2357
objects have to be explicitly deleted; in Java they are automatically
2358
deleted by the garbage collector.  Using CNI, you can allocate a new
2359
Java object using standard C++ syntax and the C++ compiler will allocate
2360
memory from the garbage collector.  If you have overloaded
2361
constructors, the compiler will choose the correct one using standard
2362
C++ overload resolution rules.
2363
 
2364
For example:
2365
 
2366
     java::util::Hashtable *ht = new java::util::Hashtable(120);
2367
 
2368

2369
File: gcj.info,  Node: Memory allocation,  Next: Arrays,  Prev: Object allocation,  Up: About CNI
2370
 
2371
12.9 Memory allocation
2372
======================
2373
 
2374
When allocating memory in CNI methods it is best to handle
2375
out-of-memory conditions by throwing a Java exception.  These functions
2376
are provided for that purpose:
2377
 
2378
 -- Function: void* JvMalloc (jsize SIZE)
2379
     Calls malloc.  Throws `java.lang.OutOfMemoryError' if allocation
2380
     fails.
2381
 
2382
 -- Function: void* JvRealloc (void* PTR, jsize SIZE)
2383
     Calls realloc.  Throws `java.lang.OutOfMemoryError' if
2384
     reallocation fails.
2385
 
2386
 -- Function: void JvFree (void* PTR)
2387
     Calls free.
2388
 
2389

2390
File: gcj.info,  Node: Arrays,  Next: Methods,  Prev: Memory allocation,  Up: About CNI
2391
 
2392
12.10 Arrays
2393
============
2394
 
2395
While in many ways Java is similar to C and C++, it is quite different
2396
in its treatment of arrays.  C arrays are based on the idea of pointer
2397
arithmetic, which would be incompatible with Java's security
2398
requirements.  Java arrays are true objects (array types inherit from
2399
`java.lang.Object').  An array-valued variable is one that contains a
2400
reference (pointer) to an array object.
2401
 
2402
   Referencing a Java array in C++ code is done using the `JArray'
2403
template, which as defined as follows:
2404
 
2405
     class __JArray : public java::lang::Object
2406
     {
2407
     public:
2408
       int length;
2409
     };
2410
 
2411
     template
2412
     class JArray : public __JArray
2413
     {
2414
       T data[0];
2415
     public:
2416
       T& operator[](jint i) { return data[i]; }
2417
     };
2418
 
2419
   There are a number of `typedef's which correspond to `typedef's from
2420
the JNI.  Each is the type of an array holding objects of the relevant
2421
type:
2422
 
2423
     typedef __JArray *jarray;
2424
     typedef JArray *jobjectArray;
2425
     typedef JArray *jbooleanArray;
2426
     typedef JArray *jbyteArray;
2427
     typedef JArray *jcharArray;
2428
     typedef JArray *jshortArray;
2429
     typedef JArray *jintArray;
2430
     typedef JArray *jlongArray;
2431
     typedef JArray *jfloatArray;
2432
     typedef JArray *jdoubleArray;
2433
 
2434
 -- Method on template: T* elements (JArray ARRAY)
2435
     This template function can be used to get a pointer to the
2436
     elements of the `array'.  For instance, you can fetch a pointer to
2437
     the integers that make up an `int[]' like so:
2438
 
2439
          extern jintArray foo;
2440
          jint *intp = elements (foo);
2441
 
2442
     The name of this function may change in the future.
2443
 
2444
 -- Function: jobjectArray JvNewObjectArray (jsize LENGTH, jclass
2445
          KLASS, jobject INIT)
2446
     This creates a new array whose elements have reference type.
2447
     `klass' is the type of elements of the array and `init' is the
2448
     initial value put into every slot in the array.
2449
 
2450
     using namespace java::lang;
2451
     JArray *array
2452
       = (JArray *) JvNewObjectArray(length, &String::class$, NULL);
2453
 
2454
12.10.1 Creating arrays
2455
-----------------------
2456
 
2457
For each primitive type there is a function which can be used to create
2458
a new array of that type.  The name of the function is of the form:
2459
 
2460
     JvNewTYPEArray
2461
 
2462
For example:
2463
 
2464
     JvNewBooleanArray
2465
 
2466
can be used to create an array of Java primitive boolean types.
2467
 
2468
The following function definition is the template for all such
2469
functions:
2470
 
2471
 -- Function: jbooleanArray JvNewBooleanArray (jint LENGTH)
2472
     Create's an array LENGTH indices long.
2473
 
2474
 -- Function: jsize JvGetArrayLength (jarray ARRAY)
2475
     Returns the length of the ARRAY.
2476
 
2477

2478
File: gcj.info,  Node: Methods,  Next: Strings,  Prev: Arrays,  Up: About CNI
2479
 
2480
12.11 Methods
2481
=============
2482
 
2483
Java methods are mapped directly into C++ methods.  The header files
2484
generated by `gcjh' include the appropriate method definitions.
2485
Basically, the generated methods have the same names and
2486
_corresponding_ types as the Java methods, and are called in the
2487
natural manner.
2488
 
2489
12.11.1 Overloading
2490
-------------------
2491
 
2492
Both Java and C++ provide method overloading, where multiple methods in
2493
a class have the same name, and the correct one is chosen (at compile
2494
time) depending on the argument types.  The rules for choosing the
2495
correct method are (as expected) more complicated in C++ than in Java,
2496
but given a set of overloaded methods generated by `gcjh' the C++
2497
compiler will choose the expected one.
2498
 
2499
   Common assemblers and linkers are not aware of C++ overloading, so
2500
the standard implementation strategy is to encode the parameter types
2501
of a method into its assembly-level name.  This encoding is called
2502
"mangling", and the encoded name is the "mangled name".  The same
2503
mechanism is used to implement Java overloading.  For C++/Java
2504
interoperability, it is important that both the Java and C++ compilers
2505
use the _same_ encoding scheme.
2506
 
2507
12.11.2 Static methods
2508
----------------------
2509
 
2510
Static Java methods are invoked in CNI using the standard C++ syntax,
2511
using the `::' operator rather than the `.' operator.
2512
 
2513
For example:
2514
 
2515
     jint i = java::lang::Math::round((jfloat) 2.3);
2516
 
2517
C++ method definition syntax is used to define a static native method.
2518
For example:
2519
 
2520
     #include 
2521
     java::lang::Integer*
2522
     java::lang::Integer::getInteger(jstring str)
2523
     {
2524
       ...
2525
     }
2526
 
2527
12.11.3 Object Constructors
2528
---------------------------
2529
 
2530
Constructors are called implicitly as part of object allocation using
2531
the `new' operator.
2532
 
2533
For example:
2534
 
2535
     java::lang::Integer *x = new java::lang::Integer(234);
2536
 
2537
   Java does not allow a constructor to be a native method.  This
2538
limitation can be coded round however because a constructor can _call_
2539
a native method.
2540
 
2541
12.11.4 Instance methods
2542
------------------------
2543
 
2544
Calling a Java instance method from a C++ CNI method is done using the
2545
standard C++ syntax, e.g.:
2546
 
2547
     // First create the Java object.
2548
     java::lang::Integer *x = new java::lang::Integer(234);
2549
     // Now call a method.
2550
     jint prim_value = x->intValue();
2551
     if (x->longValue == 0)
2552
       ...
2553
 
2554
Defining a Java native instance method is also done the natural way:
2555
 
2556
     #include 
2557
 
2558
     jdouble
2559
     java::lang:Integer::doubleValue()
2560
     {
2561
       return (jdouble) value;
2562
     }
2563
 
2564
12.11.5 Interface methods
2565
-------------------------
2566
 
2567
In Java you can call a method using an interface reference.  This is
2568
supported, but not completely.  *Note Interfaces::.
2569
 
2570

2571
File: gcj.info,  Node: Strings,  Next: Mixing with C++,  Prev: Methods,  Up: About CNI
2572
 
2573
12.12 Strings
2574
=============
2575
 
2576
CNI provides a number of utility functions for working with Java Java
2577
`String' objects.  The names and interfaces are analogous to those of
2578
JNI.
2579
 
2580
 -- Function: jstring JvNewString (const char* CHARS, jsize LEN)
2581
     Returns a Java `String' object with characters from the C string
2582
     CHARS up to the index LEN in that array.
2583
 
2584
 -- Function: jstring JvNewStringLatin1 (const char* BYTES, jsize LEN)
2585
     Returns a Java `String' made up of LEN bytes from BYTES.
2586
 
2587
 -- Function: jstring JvNewStringLatin1 (const char* BYTES)
2588
     As above but the length of the `String' is `strlen(BYTES)'.
2589
 
2590
 -- Function: jstring JvNewStringUTF (const char* BYTES)
2591
     Returns a `String' which is made up of the UTF encoded characters
2592
     present in the C string BYTES.
2593
 
2594
 -- Function: jchar* JvGetStringChars (jstring STR)
2595
     Returns a pointer to an array of characters making up the `String'
2596
     STR.
2597
 
2598
 -- Function: int JvGetStringUTFLength (jstring STR)
2599
     Returns the number of bytes required to encode the contents of the
2600
     `String' STR in UTF-8.
2601
 
2602
 -- Function: jsize JvGetStringUTFRegion (jstring STR, jsize START,
2603
          jsize LEN, char* BUF)
2604
     Puts the UTF-8 encoding of a region of the `String' STR into the
2605
     buffer `buf'.  The region to fetch is marked by START and LEN.
2606
 
2607
     Note that BUF is a buffer, not a C string.  It is _not_ null
2608
     terminated.
2609
 
2610

2611
File: gcj.info,  Node: Mixing with C++,  Next: Exception Handling,  Prev: Strings,  Up: About CNI
2612
 
2613
12.13 Interoperating with C/C++
2614
===============================
2615
 
2616
Because CNI is designed to represent Java classes and methods it cannot
2617
be mixed readily with C/C++ types.
2618
 
2619
   One important restriction is that Java classes cannot have non-Java
2620
type instance or static variables and cannot have methods which take
2621
non-Java types as arguments or return non-Java types.
2622
 
2623
None of the following is possible with CNI:
2624
 
2625
 
2626
     class ::MyClass : public java::lang::Object
2627
     {
2628
        char* variable;  // char* is not a valid Java type.
2629
     }
2630
 
2631
 
2632
     uint
2633
     ::SomeClass::someMethod (char *arg)
2634
     {
2635
       .
2636
       .
2637
       .
2638
     }   // `uint' is not a valid Java type, neither is `char*'
2639
 
2640
Of course, it is ok to use C/C++ types within the scope of a method:
2641
 
2642
     jint
2643
     ::SomeClass::otherMethod (jstring str)
2644
     {
2645
        char *arg = ...
2646
        .
2647
        .
2648
        .
2649
     }
2650
 
2651
12.13.1 RawData
2652
---------------
2653
 
2654
The above restriction can be problematic, so CNI includes the
2655
`gnu.gcj.RawData' class.  The `RawData' class is a "non-scanned
2656
reference" type.  In other words variables declared of type `RawData'
2657
can contain any data and are not checked by the compiler or memory
2658
manager in any way.
2659
 
2660
   This means that you can put C/C++ data structures (including classes)
2661
in your CNI classes, as long as you use the appropriate cast.
2662
 
2663
Here are some examples:
2664
 
2665
 
2666
     class ::MyClass : public java::lang::Object
2667
     {
2668
        gnu.gcj.RawData string;
2669
 
2670
        MyClass ();
2671
        gnu.gcj.RawData getText ();
2672
        void printText ();
2673
     }
2674
 
2675
     ::MyClass::MyClass ()
2676
     {
2677
        char* text = ...
2678
        string = text;
2679
     }
2680
 
2681
     gnu.gcj.RawData
2682
     ::MyClass::getText ()
2683
     {
2684
        return string;
2685
     }
2686
 
2687
     void
2688
     ::MyClass::printText ()
2689
     {
2690
       printf("%s\n", (char*) string);
2691
     }
2692
 
2693
12.13.2 RawDataManaged
2694
----------------------
2695
 
2696
`gnu.gcj.RawDataManaged' is another type used to indicate special data
2697
used by native code. Unlike the `RawData' type, fields declared as
2698
`RawDataManaged' will be "marked" by the memory manager and considered
2699
for garbage collection.
2700
 
2701
   Native data which is allocated using CNI's `JvAllocBytes()' function
2702
and stored in a `RawDataManaged' will be automatically freed when the
2703
Java object it is associated with becomes unreachable.
2704
 
2705
12.13.3 Native memory allocation
2706
--------------------------------
2707
 
2708
 -- Function: void* JvAllocBytes (jsize SIZE)
2709
     Allocates SIZE bytes from the heap.  The memory returned is zeroed.
2710
     This memory is not scanned for pointers by the garbage collector,
2711
     but will be freed if no references to it are discovered.
2712
 
2713
     This function can be useful if you need to associate some native
2714
     data with a Java object. Using a CNI's special `RawDataManaged'
2715
     type, native data allocated with `JvAllocBytes' will be
2716
     automatically freed when the Java object itself becomes
2717
     unreachable.
2718
 
2719
12.13.4 Posix signals
2720
---------------------
2721
 
2722
On Posix based systems the `libgcj' library uses several signals
2723
internally.  CNI code should not attempt to use the same signals as
2724
doing so may cause `libgcj' and/or the CNI code to fail.
2725
 
2726
   SIGSEGV is used on many systems to generate `NullPointerExceptions'.
2727
SIGCHLD is used internally by `Runtime.exec()'.  Several other signals
2728
(that vary from platform to platform) can be used by the memory manager
2729
and by `Thread.interrupt()'.
2730
 
2731

2732
File: gcj.info,  Node: Exception Handling,  Next: Synchronization,  Prev: Mixing with C++,  Up: About CNI
2733
 
2734
12.14 Exception Handling
2735
========================
2736
 
2737
While C++ and Java share a common exception handling framework, things
2738
are not yet perfectly integrated.  The main issue is that the run-time
2739
type information facilities of the two languages are not integrated.
2740
 
2741
   Still, things work fairly well.  You can throw a Java exception from
2742
C++ using the ordinary `throw' construct, and this exception can be
2743
caught by Java code.  Similarly, you can catch an exception thrown from
2744
Java using the C++ `catch' construct.
2745
 
2746
Here is an example:
2747
 
2748
     if (i >= count)
2749
        throw new java::lang::IndexOutOfBoundsException();
2750
 
2751
   Normally, G++ will automatically detect when you are writing C++
2752
code that uses Java exceptions, and handle them appropriately.
2753
However, if C++ code only needs to execute destructors when Java
2754
exceptions are thrown through it, GCC will guess incorrectly.  Sample
2755
problematic code:
2756
 
2757
     struct S { ~S(); };
2758
 
2759
     extern void bar();    // Is implemented in Java and may throw exceptions.
2760
 
2761
     void foo()
2762
     {
2763
       S s;
2764
       bar();
2765
     }
2766
 
2767
   The usual effect of an incorrect guess is a link failure,
2768
complaining of a missing routine called `__gxx_personality_v0'.
2769
 
2770
   You can inform the compiler that Java exceptions are to be used in a
2771
translation unit, irrespective of what it might think, by writing
2772
`#pragma GCC java_exceptions' at the head of the file.  This `#pragma'
2773
must appear before any functions that throw or catch exceptions, or run
2774
destructors when exceptions are thrown through them.
2775
 
2776

2777
File: gcj.info,  Node: Synchronization,  Next: Invocation,  Prev: Exception Handling,  Up: About CNI
2778
 
2779
12.15 Synchronization
2780
=====================
2781
 
2782
Each Java object has an implicit monitor.  The Java VM uses the
2783
instruction `monitorenter' to acquire and lock a monitor, and
2784
`monitorexit' to release it.
2785
 
2786
   The corresponding CNI macros are `JvMonitorEnter' and
2787
`JvMonitorExit' (JNI has similar  methods `MonitorEnter' and
2788
`MonitorExit').
2789
 
2790
   The Java source language does not provide direct access to these
2791
primitives.  Instead, there is a `synchronized' statement that does an
2792
implicit `monitorenter' before entry to the block, and does a
2793
`monitorexit' on exit from the block.  Note that the lock has to be
2794
released even when the block is abnormally terminated by an exception,
2795
which means there is an implicit `try finally' surrounding
2796
synchronization locks.
2797
 
2798
   From C++, it makes sense to use a destructor to release a lock.  CNI
2799
defines the following utility class:
2800
 
2801
     class JvSynchronize() {
2802
       jobject obj;
2803
       JvSynchronize(jobject o) { obj = o; JvMonitorEnter(o); }
2804
       ~JvSynchronize() { JvMonitorExit(obj); }
2805
     };
2806
 
2807
   So this Java code:
2808
 
2809
     synchronized (OBJ)
2810
     {
2811
        CODE
2812
     }
2813
 
2814
might become this C++ code:
2815
 
2816
     {
2817
        JvSynchronize dummy (OBJ);
2818
        CODE;
2819
     }
2820
 
2821
   Java also has methods with the `synchronized' attribute.  This is
2822
equivalent to wrapping the entire method body in a `synchronized'
2823
statement.  (Alternatively, an implementation could require the caller
2824
to do the synchronization.  This is not practical for a compiler,
2825
because each virtual method call would have to test at run-time if
2826
synchronization is needed.)  Since in `gcj' the `synchronized'
2827
attribute is handled by the method implementation, it is up to the
2828
programmer of a synchronized native method to handle the synchronization
2829
(in the C++ implementation of the method).  In other words, you need to
2830
manually add `JvSynchronize' in a `native synchronized' method.
2831
 
2832

2833
File: gcj.info,  Node: Invocation,  Next: Reflection,  Prev: Synchronization,  Up: About CNI
2834
 
2835
12.16 Invocation
2836
================
2837
 
2838
CNI permits C++ applications to make calls into Java classes, in
2839
addition to allowing Java code to call into C++. Several functions,
2840
known as the "invocation API", are provided to support this.
2841
 
2842
 -- Function: jint JvCreateJavaVM (JvVMInitArgs* VM_ARGS)
2843
     Initializes the Java runtime. This function performs essential
2844
     initialization of the threads interface, garbage collector,
2845
     exception handling and other key aspects of the runtime. It must
2846
     be called once by an application with a non-Java `main()'
2847
     function, before any other Java or CNI calls are made.  It is
2848
     safe, but not recommended, to call `JvCreateJavaVM()' more than
2849
     once provided it is only called from a single thread.  The VMARGS
2850
     parameter can be used to specify initialization parameters for the
2851
     Java runtime. It may be `NULL'.
2852
 
2853
     JvVMInitArgs represents a list of virtual machine initialization
2854
     arguments. `JvCreateJavaVM()' ignores the version field.
2855
 
2856
          typedef struct JvVMOption
2857
          {
2858
            // a VM initialization option
2859
            char* optionString;
2860
            // extra information associated with this option
2861
            void* extraInfo;
2862
          } JvVMOption;
2863
 
2864
          typedef struct JvVMInitArgs
2865
          {
2866
            // for compatibility with JavaVMInitArgs
2867
            jint version;
2868
 
2869
            // number of VM initialization options
2870
            jint nOptions;
2871
 
2872
            // an array of VM initialization options
2873
            JvVMOption* options;
2874
 
2875
            // true if the option parser should ignore unrecognized options
2876
            jboolean ignoreUnrecognized;
2877
          } JvVMInitArgs;
2878
 
2879
     `JvCreateJavaVM()' returns `0' upon success, or `-1' if the
2880
     runtime is already initialized.
2881
 
2882
     _Note:_ In GCJ 3.1, the `vm_args' parameter is ignored. It is
2883
     recognized and used as of release 4.0.
2884
 
2885
 -- Function: java::lang::Thread* JvAttachCurrentThread (jstring NAME,
2886
          java::lang::ThreadGroup* GROUP)
2887
     Registers an existing thread with the Java runtime.  This must be
2888
     called once from each thread, before that thread makes any other
2889
     Java or CNI calls. It must be called after `JvCreateJavaVM'.  NAME
2890
     specifies a name for the thread. It may be `NULL', in which case a
2891
     name will be generated.  GROUP is the ThreadGroup in which this
2892
     thread will be a member. If it is `NULL', the thread will be a
2893
     member of the main thread group.  The return value is the Java
2894
     `Thread' object that represents the thread.  It is safe to call
2895
     `JvAttachCurrentThread()' more than once from the same thread. If
2896
     the thread is already attached, the call is ignored and the current
2897
     thread object is returned.
2898
 
2899
 -- Function: jint JvDetachCurrentThread ()
2900
     Unregisters a thread from the Java runtime. This should be called
2901
     by threads that were attached using `JvAttachCurrentThread()',
2902
     after they have finished making calls to Java code. This ensures
2903
     that any resources associated with the thread become eligible for
2904
     garbage collection.  This function returns `0' upon success, or
2905
     `-1' if the current thread is not attached.
2906
 
2907
12.16.1 Handling uncaught exceptions
2908
------------------------------------
2909
 
2910
If an exception is thrown from Java code called using the invocation
2911
API, and no handler for the exception can be found, the runtime will
2912
abort the application. In order to make the application more robust, it
2913
is recommended that code which uses the invocation API be wrapped by a
2914
top-level try/catch block that catches all Java exceptions.
2915
 
2916
12.16.2 Example
2917
---------------
2918
 
2919
The following code demonstrates the use of the invocation API. In this
2920
example, the C++ application initializes the Java runtime and attaches
2921
itself. The `java.lang.System' class is initialized in order to access
2922
its `out' field, and a Java string is printed. Finally, the thread is
2923
detached from the runtime once it has finished making Java calls.
2924
Everything is wrapped with a try/catch block to provide a default
2925
handler for any uncaught exceptions.
2926
 
2927
   The example can be compiled with `c++ -c test.cc; gcj test.o'.
2928
 
2929
     // test.cc
2930
     #include 
2931
     #include 
2932
     #include 
2933
     #include 
2934
 
2935
     int main(int argc, char *argv[])
2936
     {
2937
       using namespace java::lang;
2938
 
2939
       try
2940
       {
2941
         JvCreateJavaVM(NULL);
2942
         JvAttachCurrentThread(NULL, NULL);
2943
 
2944
         String *message = JvNewStringLatin1("Hello from C++");
2945
         JvInitClass(&System::class$);
2946
         System::out->println(message);
2947
 
2948
         JvDetachCurrentThread();
2949
       }
2950
       catch (Throwable *t)
2951
       {
2952
         System::err->println(JvNewStringLatin1("Unhandled Java exception:"));
2953
         t->printStackTrace();
2954
       }
2955
     }
2956
 
2957

2958
File: gcj.info,  Node: Reflection,  Prev: Invocation,  Up: About CNI
2959
 
2960
12.17 Reflection
2961
================
2962
 
2963
Reflection is possible with CNI code, it functions similarly to how it
2964
functions with JNI.
2965
 
2966
   The types `jfieldID' and `jmethodID' are as in JNI.
2967
 
2968
The functions:
2969
 
2970
   * `JvFromReflectedField',
2971
 
2972
   * `JvFromReflectedMethod',
2973
 
2974
   * `JvToReflectedField'
2975
 
2976
   * `JvToFromReflectedMethod'
2977
 
2978
will be added shortly, as will other functions corresponding to JNI.
2979
 
2980

2981
File: gcj.info,  Node: System properties,  Next: Resources,  Prev: About CNI,  Up: Top
2982
 
2983
13 System properties
2984
********************
2985
 
2986
The runtime behavior of the `libgcj' library can be modified by setting
2987
certain system properties.  These properties can be compiled into the
2988
program using the `-DNAME[=VALUE]' option to `gcj' or by setting them
2989
explicitly in the program by calling the
2990
`java.lang.System.setProperty()' method.  Some system properties are
2991
only used for informational purposes (like giving a version number or a
2992
user name).  A program can inspect the current value of a property by
2993
calling the `java.lang.System.getProperty()' method.
2994
 
2995
* Menu:
2996
 
2997
* Standard Properties::         Standard properties supported by `libgcj'
2998
* GNU Classpath Properties::    Properties found in Classpath based libraries
2999
* libgcj Runtime Properties::   Properties specific to `libgcj'
3000
 
3001

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

3157
File: gcj.info,  Node: GNU Classpath Properties,  Next: libgcj Runtime Properties,  Prev: Standard Properties,  Up: System properties
3158
 
3159
13.2 GNU Classpath Properties
3160
=============================
3161
 
3162
`libgcj' is based on the GNU Classpath (Essential Libraries for Java) a
3163
GNU project to create free core class libraries for use with virtual
3164
machines and compilers for the Java language.  The following properties
3165
are common to libraries based on GNU Classpath.
3166
 
3167
`gcj.dumpobject'
3168
     Enables printing serialization debugging by the
3169
     `java.io.ObjectInput' and `java.io.ObjectOutput' classes when set
3170
     to something else then the empty string.  Only used when running a
3171
     debug build of the library.
3172
 
3173
`gnu.classpath.vm.shortname'
3174
     This is a succinct name of the virtual machine.  For `libgcj',
3175
     this will always be `libgcj'.
3176
 
3177
`gnu.classpath.home.url'
3178
     A base URL used for finding system property files (e.g.,
3179
     `classpath.security').  By default this is a `file:' URL pointing
3180
     to the `lib' directory under `java.home'.
3181
 
3182
 
3183

3184
File: gcj.info,  Node: libgcj Runtime Properties,  Prev: GNU Classpath Properties,  Up: System properties
3185
 
3186
13.3 libgcj Runtime Properties
3187
==============================
3188
 
3189
The following properties are specific to the `libgcj' runtime and will
3190
normally not be found in other core libraries for the java language.
3191
 
3192
`java.fullversion'
3193
     The combination of `java.vm.name' and `java.vm.version'.
3194
 
3195
`java.vm.info'
3196
     Same as `java.fullversion'.
3197
 
3198
`impl.prefix'
3199
     Used by the `java.net.DatagramSocket' class when set to something
3200
     else then the empty string.  When set all newly created
3201
     `DatagramSocket's will try to load a class
3202
     `java.net.[impl.prefix]DatagramSocketImpl' instead of the normal
3203
     `java.net.PlainDatagramSocketImpl'.
3204
 
3205
`gnu.gcj.progname'
3206
     The class or binary name that was used to invoke the program. This
3207
     will be the name of the "main" class in the case where the `gij'
3208
     front end is used, or the program binary name in the case where an
3209
     application is compiled to a native binary.
3210
 
3211
`gnu.gcj.user.realname'
3212
     The real name of the user, as taken from the password file.  This
3213
     may not always hold only the user's name (as some sites put extra
3214
     information in this field).  Also, this property is not available
3215
     on all platforms.
3216
 
3217
`gnu.gcj.runtime.NameFinder.use_addr2line'
3218
     Whether an external process, `addr2line', should be used to
3219
     determine line number information when tracing the stack. Setting
3220
     this to `false' may suppress line numbers when printing stack
3221
     traces and when using the java.util.logging infrastructure.
3222
     However, performance may improve significantly for applications
3223
     that print stack traces or make logging calls frequently.
3224
 
3225
`gnu.gcj.runtime.NameFinder.show_raw'
3226
     Whether the address of a stack frame should be printed when the
3227
     line number is unavailable. Setting this to `true' will cause the
3228
     name of the object and the offset within that object to be printed
3229
     when no line number is available.  This allows for off-line
3230
     decoding of stack traces if necessary debug information is
3231
     available.  The default is `false', no raw addresses are printed.
3232
 
3233
`gnu.gcj.runtime.NameFinder.remove_unknown'
3234
     Whether stack frames for non-java code should be included in a
3235
     stack trace.  The default value is `true', stack frames for
3236
     non-java code are suppressed.  Setting this to `false' will cause
3237
     any non-java stack frames to be printed in addition to frames for
3238
     the java code.
3239
 
3240
`gnu.gcj.runtime.VMClassLoader.library_control'
3241
     This controls how shared libraries are automatically loaded by the
3242
     built-in class loader.  If this property is set to `full', a full
3243
     search is done for each requested class.  If this property is set
3244
     to `cache', then any failed lookups are cached and not tried again.
3245
     If this property is set to `never' (the default), then lookups are
3246
     never done.  For more information, *Note Extensions::.
3247
 
3248
`gnu.gcj.runtime.endorsed.dirs'
3249
     This is like the standard `java.endorsed.dirs', property, but
3250
     specifies some extra directories which are searched after the
3251
     standard endorsed directories.  This is primarily useful for
3252
     telling `libgcj' about additional libraries which are ordinarily
3253
     incorporated into the JDK, and which should be loaded by the
3254
     bootstrap class loader, but which are not yet part of `libgcj'
3255
     itself for some reason.
3256
 
3257
`gnu.gcj.jit.compiler'
3258
     This is the full path to `gcj' executable which should be used to
3259
     compile classes just-in-time when `ClassLoader.defineClass' is
3260
     called.  If not set, `gcj' will not be invoked by the runtime;
3261
     this can also be controlled via `Compiler.disable'.
3262
 
3263
`gnu.gcj.jit.options'
3264
     This is a space-separated string of options which should be passed
3265
     to `gcj' when in JIT mode.  If not set, a sensible default is
3266
     chosen.
3267
 
3268
`gnu.gcj.jit.cachedir'
3269
     This is the directory where cached shared library files are
3270
     stored.  If not set, JIT compilation is disabled.  This should
3271
     never be set to a directory that is writable by any other user.
3272
 
3273
`gnu.gcj.precompiled.db.path'
3274
     This is a sequence of file names, each referring to a file created
3275
     by `gcj-dbtool'.  These files will be used by `libgcj' to find
3276
     shared libraries corresponding to classes that are loaded from
3277
     bytecode.  `libgcj' often has a built-in default database; it can
3278
     be queried using `gcj-dbtool -p'.
3279
 
3280
 
3281

3282
File: gcj.info,  Node: Resources,  Next: Index,  Prev: System properties,  Up: Top
3283
 
3284
14 Resources
3285
************
3286
 
3287
While writing `gcj' and `libgcj' we have, of course, relied heavily on
3288
documentation from Sun Microsystems.  In particular we have used The
3289
Java Language Specification (both first and second editions), the Java
3290
Class Libraries (volumes one and two), and the Java Virtual Machine
3291
Specification.  In addition we've used the online documentation at
3292
`http://java.sun.com/'.
3293
 
3294
   The current `gcj' home page is `http://gcc.gnu.org/java/'.
3295
 
3296
   For more information on gcc, see `http://gcc.gnu.org/'.
3297
 
3298
   Some `libgcj' testing is done using the Mauve test suite.  This is a
3299
free software Java class library test suite which is being written
3300
because the JCK is not free.  See `http://sources.redhat.com/mauve/'
3301
for more information.
3302
 
3303

3304
File: gcj.info,  Node: Index,  Prev: Resources,  Up: Top
3305
 
3306
Index
3307
*****
3308
 
3309
 
3310
* Menu:
3311
3312
* class path:                            Input Options.        (line  6)
3313
* class$:                                Reference types.      (line 20)
3314
* elements on template:         Arrays.               (line 46)
3315
* FDL, GNU Free Documentation License:   GNU Free Documentation License.
3316
                                                               (line  6)
3317
* GCJ_PROPERTIES:                        Extensions.           (line 56)
3318
* jclass:                                Reference types.      (line 16)
3319
* jobject:                               Reference types.      (line 16)
3320
* jstring:                               Reference types.      (line 16)
3321
* JvAllocBytes:                          Mixing with C++.      (line 99)
3322
* JvAttachCurrentThread:                 Invocation.           (line 55)
3323
* JvCreateJavaVM:                        Invocation.           (line 11)
3324
* JvDetachCurrentThread:                 Invocation.           (line 68)
3325
* JvFree:                                Memory allocation.    (line 19)
3326
* JvGetArrayLength:                      Arrays.               (line 86)
3327
* JvGetStringChars:                      Strings.              (line 25)
3328
* JvGetStringUTFLength:                  Strings.              (line 29)
3329
* JvGetStringUTFRegion:                  Strings.              (line 34)
3330
* JvMalloc:                              Memory allocation.    (line 11)
3331
* JvNewBooleanArray:                     Arrays.               (line 83)
3332
* JvNewObjectArray:                      Arrays.               (line 57)
3333
* JvNewString:                           Strings.              (line 11)
3334
* JvNewStringLatin1:                     Strings.              (line 15)
3335
 
3336
 
3337
* JvRealloc:                             Memory allocation.    (line 15)
3338
3339
3340

3341
Tag Table:
3342
Node: Top2846
3343
Node: Copying4168
3344
Node: GNU Free Documentation License23363
3345
Node: Invoking gcj45775
3346
Node: Input and output files46474
3347
Node: Input Options48000
3348
Node: Encodings51148
3349
Node: Warnings52354
3350
Node: Linking53467
3351
Node: Code Generation56406
3352
Node: Configure-time Options62956
3353
Node: Compatibility64379
3354
Node: Limitations64859
3355
Node: Extensions66441
3356
Node: Invoking gcjh69535
3357
Node: Invoking gjnih71890
3358
Node: Invoking jv-scan74078
3359
Node: Invoking jcf-dump75120
3360
Node: Invoking gij76068
3361
Node: Invoking gcj-dbtool79319
3362
Node: Invoking jv-convert81785
3363
Node: Invoking grmic82864
3364
Node: Invoking grmiregistry84254
3365
Node: About CNI84667
3366
Node: Basic concepts86109
3367
Node: Packages89005
3368
Node: Primitive types91333
3369
Node: Reference types93011
3370
Node: Interfaces94100
3371
Node: Objects and Classes95011
3372
Node: Class Initialization97206
3373
Node: Object allocation99548
3374
Node: Memory allocation100338
3375
Node: Arrays100970
3376
Node: Methods103781
3377
Node: Strings106602
3378
Node: Mixing with C++108086
3379
Node: Exception Handling111557
3380
Node: Synchronization113191
3381
Node: Invocation115181
3382
Node: Reflection120117
3383
Node: System properties120578
3384
Node: Standard Properties121455
3385
Node: GNU Classpath Properties125887
3386
Node: libgcj Runtime Properties126934
3387
Node: Resources131436

powered by: WebSVN 2.1.0

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