invoke GCJ .o files from C/C++ program

Bryce McKinlay bryce@albatross.co.nz
Fri Jul 7 00:33:00 GMT 2000


Cecilia Vy-Ai Le wrote:

> -- Then, I create the following files.  I create
> executeable MainApp.  When I run it, it stops when
> trying to invoke method printLine().  I walk through
> the debugger, and see that java::lang:Object does not
> recognize method printLine() (the method is hidden
> some how in the class Object).  Does CNI have any API
> to invoke this method for now?

I think the problem here may be that you have class names which are
different from the filenames that they are declared in (although the
compiler should pick this up...). I renamed "JavaHello.java" to
"JavaTool.java" and changed JavaMain::run to MainApp::run, then compiled
with the following command:

$ gcj MainApp.java JavaTool.java RunApp.cc --main=MainApp -o app -I.

... and it works fine:

$ ./app
Hello World from Java

regards

  [ bryce ]




More information about the Java mailing list