This is the mail archive of the
java-patches@sourceware.cygnus.com
mailing list for the Java project.
[PATCH] faq.html
- To: java-patches at sourceware dot cygnus dot com
- Subject: [PATCH] faq.html
- From: Joerg Brunsmann <joerg dot brunsmann at FernUni-Hagen dot de>
- Date: Mon, 14 Feb 2000 17:12:31 +0100
- Organization: Fernuniversitaet Hagen - Software Engineering (Praktische Informatik III)
Hi,
just went through my mail box and thought this patch might
reflect the latest FAQs.
2000-02-14 Joerg Brunsmann <joerg.brusmann@FernUni-Hagen.de>
* faq.html: Some new faq entries.
Index: htdocs/faq.html
===================================================================
RCS file: /cvs/java/htdocs/faq.html,v
retrieving revision 1.11
diff -c -3 -p -r1.11 faq.html
*** faq.html 2000/02/09 01:03:58 1.11
--- faq.html 2000/02/14 16:07:22
***************
*** 54,59 ****
--- 54,60 ----
<li><a href="#1_4">Why isn't libgcj part of GCC?</a>
<li><a href="#1_5">Will gcj and libgcj work on my machine?</a>
<li><a href="#1_6">How can I debug my Java program?</a>
+ <li><a href="#1_7">Can i interface byte-compiled and native java code?</a>
</ol>
<li><a href="#2_0">Java Feature Support</a>
<ol>
***************
*** 86,91 ****
--- 87,94 ----
<li><a href="#4_5">How does gcj resolve wether to compile .class or
.java files? </a>
<li><a href="#4_6">I'm getting link errors!</a>
+ <li><a href="#4_7">I'm getting 'gcj: libgcj.spec: No such file or directory'</a>
+ <li><a href="#4_8">How do I compile a more complex example</a>
</ol>
<li><a href="#5_0">Runtime Questions</a>
<ol>
***************
*** 139,145 ****
<dd>You can send simple bug fixes in as patches. Please follow the <a href="http://egcs.cygnus.com/contribute.html">GCC
guidelines for submitting patches</a>. For more complex changes, you
must sign copyright over to Cygnus. See the <a href="contrib.html">contribution</a>
! page for details.</dd>
<p></p>
<dt>
<hr>
--- 142,154 ----
<dd>You can send simple bug fixes in as patches. Please follow the <a href="http://egcs.cygnus.com/contribute.html">GCC
guidelines for submitting patches</a>. For more complex changes, you
must sign copyright over to Cygnus. See the <a href="contrib.html">contribution</a>
! page for details.
! You might also want to cvs check out the www documentation with
! <p>
! $ cvs -d:pserver:anoncvs@anoncvs.cygnus.com:/cvs/java co htdocs
! <p>
! enhance it and send the patches to java-patches@sourceware.cygnus.com
! </dd>
<p></p>
<dt>
<hr>
***************
*** 170,175 ****
--- 179,214 ----
you will need to use a recent development snapshot of gdb from <a href="ftp://sourceware.cygnus.com/pub/gdb/snapshots/">ftp://sourceware.cygnus.com/pub/gdb/snapshots/</a> because
the standard 4.18 does not have support for linux threads.</dd>
<dt> </dt>
+
+
+ <dt>
+ <hr>
+ <h3><a name="1_7">1.7 Can i interface byte-compiled and native java code</a></h3>
+ </dt>
+ <p>
+ <dd>
+ Bryce McKinlay explains:
+ libgcj has a bytecode interpreter that allows you to mix .class files with
+ compiled code. It works pretty transparently: if a compiled version of a class is
+ not found in the application binary or linked shared libraries, the class loader
+ will search for a bytecode version in your classpath, much like a VM would. Be
+ sure to build libgcj with the --enable-interpreter option to enable this
+ functionality. Currently it only works on x86 linux AFAIK. The downside is that
+ the interpreter is unfortunately rather slow, so I doubt it will be useful in your
+ situation.
+ <p>
+ Recent snapshots of kaffe include some support for loading gcj compiled classes
+ into the VM environment. This might allow you to mix optimized native java/CNI
+ processing code with UI code running on kaffe's AWT. I havn't tried it but I
+ believe it mostly works apart from an issue with monitor locking. You might want
+ to contact Godmar Back if you are working with this.
+ <p>Tom Tromey has another use: You can even run a shared library which is
+ compiled from java code and contains a main method with gij:<p>
+ $ gcj -shared -c -o HelloWorld.so HelloWorld.java<br>
+ $ gij HelloWorld
+ This works because gij uses Class.forName, which now knows how to load shared objects.
+ </dd>
+ <dt> </dt>
</dl>
<table border="0" cellpadding="4" width="95%">
<tr bgcolor="#B0D0FF">
*************** collect2: ld returned 1 exit status
*** 475,485 ****
option to indicate the class that has the desired <tt>main</tt> method.
This is because every Java class can have a <tt>main</tt> method, thus
you have to tell gcj which one to use.</dd>
<dt> </dt>
<hr>
</dl>
<dl>
- <dt> </dt>
<dt>
<h3><a name="4_2">4.2 Can GCJ only handle source code?</a></h3>
</dt>
--- 514,528 ----
option to indicate the class that has the desired <tt>main</tt> method.
This is because every Java class can have a <tt>main</tt> method, thus
you have to tell gcj which one to use.</dd>
+ <p>
+ <dd>Also make sure to use the fully-qualified class name. If your class <i>Sample</i> is
+ defined in a package named <i>test</i> you'll have to issue:<p>
+ $ gcj -o sample --main=test.Sample Sample.o
+ </dd>
<dt> </dt>
<hr>
</dl>
<dl>
<dt>
<h3><a name="4_2">4.2 Can GCJ only handle source code?</a></h3>
</dt>
*************** collect2: ld returned 1 exit status
*** 569,574 ****
--- 612,647 ----
-fno_rtti option.
</blockquote>
</dl>
+ <dl>
+ <dt>
+ <h3><a name="4_7">4.7 I'm getting 'gcj: libgcj.spec: No such file or directory'</a></h3>
+ </dt>
+ <blockquote>
+ <p>Make sure you configure both libgcj and gcj the exact
+ same --prefix directory.
+ </blockquote>
+ </dl>
+ <dl>
+ <dt>
+ <h3><a name="4_8">4.8 How do I compile a more complex example</a></h3>
+ </dt>
+ <blockquote>
+ <p>Jeff Sturm explains: You'll probably want to use a Makefile, as you
+ would in any non-trival C program.
+ You might try adding each object to a library, e.g.:<p>
+
+ $ gcj -c Class1.java -o Class1.o<br>
+ $ gcj -c Class2.java -o Class2.o<br>
+ $ ar rv myclasses.a Class1.o Class2.o<br>
+ $ ranlib myclasses.a
+ <p>
+ then:
+ <p>
+ $ gcj myprog.java --main=myprog myclasses.a -o myprog
+ </blockquote>
+ </dl>
+
+
<dl>
<dt> </dt>
</dl>
*************** collect2: ld returned 1 exit status
*** 648,658 ****
</dd>
</dl>
<p></p>
- <p>
- <dl>
- <dd> </dd>
- </dl>
- <dl>
<hr>
<dt> </dt>
<dt>
--- 721,726 ----