Compiling java-files with imports from external jared packages

Andreas Piening andreas.piening@rrz.uni-hamburg.de
Tue Mar 14 18:31:00 GMT 2006


Hi,

I'm new to GCJ but managed to get simple HelloWorld-like programs to  
compile with gcj to binaries. I wonder if i can use gcj for one of my  
projects which is console-based only and therefore may work with gcj.
My project depends on xmlrpc which is an external java package which  
is available as jar-file to me. The code works with Netbeans (using  
jdk 1.5), but I have no luck compiling the source with gcj.

When I do a "gcj -o xmlrpcserver --main=xml_rpc_test.XMLRPCServer  
XMLRPCServer.java" I get a
XMLRPCServer.java:12: error: Class or interface  
`org.apache.xmlrpc.WebServer' not found in import.
    import org.apache.xmlrpc.WebServer;
           ^
XMLRPCServer.java:21: error: Type `WebServer' not found in  
declaration of field `server'.
        WebServer server;
        ^
2 errors

...which is quite logical, since my CLASSPATH is empty. So I do a  
"CLASSPATH=$CLASSPATH:xmlrpc-2.0.jar" to add the xmlrpc package to  
the search-base. Now I get a

/tmp/ccauJxMh.o: In function `xml_rpc_test::XMLRPCServer::XMLRPCServer 
[in-charge]()':
XMLRPCServer.java:(.text+0x2e): undefined reference to  
`org::apache::xmlrpc::WebServer::class$'
XMLRPCServer.java:(.text+0x45): undefined reference to  
`org::apache::xmlrpc::WebServer::WebServer[in-charge](int)'
/tmp/ccauJxMh.o:(.data+0x4): undefined reference to  
`org::apache::xmlrpc::WebServer::class$'
collect2: ld returned 1 exit status

...which is confusing me. GCJ seems to have found the files, but I  
don't get where it stucks.

Any hint is welcome!

Andreas Piening





More information about the Java mailing list