Forward declaration of classes needed when using GCJ?

David Daney ddaney@avtrex.com
Mon Feb 11 17:50:00 GMT 2008


Andrew W wrote:
> Consider the following two classes placed in files 
> ./net/mydomain/core/ClassA.java and
> ./net/mydomain/core/ClassB.java respectively:
> 
> package net.mydomain.core;
> public class ClassA
> {
> 
> public static void main(String[] args) throws Exception
> {
> ClassB classb = new ClassB();
> }
> 
> }
> 
> 
> package net.mydomain.core;
> public class ClassB
> {
> 
> 
> }
> 
> If I compile this using the 'normal' Java compiler like this:
> javac ./net/mydomain/core/ClassA.java ./net/mydomain/core/ClassB.java
> 
> it works fine.
> 
> Using the GCJ command:
> 
> gcj --main=ClassA ./net/mydomain/core/ClassA.java 
> ./net/mydomain/core/ClassB.java

That should be:
gcj --main=net.mydomain.core.ClassA ./net/mydomain/core/ClassA.java 
./net/mydomain/core/ClassB.java

David Daney



More information about the Gcc-help mailing list