Please support SUN VM, GCJ is inept

Write here if you have problems with your Java source code

Moderator: Board moderators

Post Reply
benreisner
New poster
Posts: 2
Joined: Wed Apr 16, 2003 11:27 pm

Please support SUN VM, GCJ is inept

Post by benreisner » Mon Apr 28, 2003 11:13 pm

Ok, I understand it was easier to implement gcj, and I've reveiwed the boards.

The technical problem with implementing an interpreted language like java is that you can't compile to native code. GCJ compiles to native code, but it is inept. Standard timing, and errors that you use for the other languages won't work with java, because you are are invoking an interpreter, not the program directly.

The answer imho is for java, you should hava a java class that you use that performs the timing and management.

You would start up your class, and it would load our program and run it. It could do any timing needed, and this timing would be accurate. It can also catch the exceptions that java throws in order to trigger correct error messages.

example boot loader class u could use.

class Bootloader{
public static void main(String[] args){
try{
long startTime=System.currentTimeMillis();
new Main();
long finishTime=System.currentTimeMillis();
System.out.println("run time="+finishTime-startTime);
}catch(OutOfMemoryException e){
System.out.println("out of memory");
}catch(Exception e){
System.out.println("wrong answer");
}
}
}

Post Reply

Return to “Java”