This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

.java to binary compilation problem


Hi,

I've been trying to compile part of the SpecJVM98 benchmark with gcj,
and ran into the following problem:

I have one class in one package....

package spec.harness;
public  class Context{
    public static java.io.PrintStream out = System.out;
    public static int getSpeed() { return speed; }
}

...and two classes in another package, importing the one above:

package spec.benchmarks._201_compress;
import spec.harness.*;
public final class Harness{
    public boolean func() { spec.harness.Context.out.println( "Yo!"); }
}
public class Main implements SpecBenchmark {
    public boolean func2() { int speed = spec.harness.Context.getSpeed(); }
}

I'm trying to compile these classes (and a bunch of others) into
one single executable, the makefile simply looks like this
(with all .java files in OBJS):

jspec: $(OBJS) 
	gcj $(OBJS) --main=SpecApplication -o jspec
%.o : %.java
	gcj -c $(JFLAGS) $< -o $@


but, this produces the following compile errors:

spec/benchmarks/_201_compress/Harness.java:58: Can't search method
`println' in package `spec.harness.Context.out'.
spec/benchmarks/_201_compress/Main.java:17: Can't search method `getSpeed'
in package `spec.harness.Context'.

I was able to get the program compiling and running without these calls,
but it breaks the verify phase of the benchmark and I don't like that.

My question: Am I just doing something terribly stupid here? Is there
anything I must do to get Harness.java to "see" spec.harness.Context
during compilation? Or isn't this possible to compile with gcj?
I'm new to gcj, so any help is appreciated.

(Note: The code does work with regular Java/Kaffe, it's the
original SPEC code, except the gui stuff was cut out.)

/Fredrik

-------------------------------------
Fredrik Warg -- [warg@ce.chalmers.se]




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]