This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
gcj
- To: help-gcc at gnu dot org
- Subject: gcj
- From: Ashwin Kapur <akapur at bellatlantic dot net>
- Date: Tue, 23 Nov 1999 05:03:37 GMT
- Newsgroups: gnu.gcc.help
- Xref: wodc7nx0 gnu.gcc.help:1932
Sorry if this is off topic but I don't see a newsgroup for
gcj specifically and this seems to be the closest one since
it's a compiler specific question. I'm trying to compile
some java code into a native binary on suse 6.2 using the
gcj in gcc 2.95-2.
The Problem:
The java file compiles into an o file but the compiler
complains about the absence of a main. The code contains a
main. Is there some specific thing I'm supposed to be doing
to compile and like code with gcj. Are there docs on this.
Is there some library I'm supposed to link to or something.
Thanks
Ashwin
Here is the source code. It is an example from the java
tutorial.
//---------------------------------------------------------------------
import java.io.*;
import java.net.*;
public class EchoClient {
public static void main(String[] args) throws
IOException {
Socket echoSocket = null;
PrintWriter out = null;
BufferedReader in = null;
try {
echoSocket = new Socket("coredump", 7);
out = new PrintWriter(echoSocket.getOutputStream(),
true);
in = new BufferedReader(new InputStreamReader(
echoSocket.getInputStream()));
} catch (UnknownHostException e) {
System.err.println("Don't know about host: coredump");
System.exit(1);
} catch (IOException e) {
System.err.println("Couldn't get I/O for "
+ "the connection to: coredump");
System.exit(1);
}
BufferedReader stdIn = new BufferedReader(
new InputStreamReader(System.in));
String userInput;
while ((userInput = stdIn.readLine()) != null) {
out.println(userInput);
System.out.println("echo: " + in.readLine());
}
out.close();
in.close();
stdIn.close();
echoSocket.close();
}
}
//--------------------------------------------------------------------------
--
#include <std_disclaimer>
#include <std_humor>