This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
RMI test of GCJ
- From: Øyvind Harboe <oyvind dot harboe at zylin dot com>
- To: <java at gcc dot gnu dot org>
- Date: Tue, 18 Mar 2003 10:23:18 +0100
- Subject: RMI test of GCJ
RMI seems to work w/GCJ, with a small snag(described below).
The GCJ hello world app below is 600k zipped. Neat.
- I ran trough the java.sun.com/rmi getting started tutorial.
- Modified the applet to the code below(i.e. a console version instead of applet).
- It ran and exited fine jusing java.exe
- When I compiled it with GCJ and ran it, it never terminated(modified it to do so below).
\thisiscool-gcc\gcc-3.3\bin\gcj -Os -s --main=examples.hello.HelloConsole -o hello.exe examples\hello\HelloConsole.class examples\hello\Hello.class
I'm not sure if this is cause for alarm.
package examples.hello;
import java.rmi.Naming;
public class HelloConsole
{
String message = "blank";
// "obj" is the identifier that we'll use to refer
// to the remote object that implements the "Hello"
// interface
Hello obj = null;
public static void main(String[] args)
{
new HelloConsole().run();
}
/**
*
*/
private void run()
{
try {
obj = (Hello)Naming.lookup("//lair/HelloServer");
message = obj.sayHello(1);
System.out.println("Hello " + message);
System.exit(0); // the program does not terminate, if I do not add this line
} catch (Exception e) {
System.out.println("HelloConsole exception: " + e.getMessage());
e.printStackTrace();
}
}
}