Compile error

Write here if you have problems with your Java source code

Moderator: Board moderators

Post Reply
Tritri
New poster
Posts: 5
Joined: Mon Mar 06, 2006 2:04 am

Compile error

Post by Tritri »

Hi, I'm a beginner and I'm trying to submit a problem and always get the same 'Compilation Error' response from the Judge.

I try to write a simple Hello World program but the result was the same. Do you know if there is a problem with the compiler or I don't know to write a HW program?

Greetings.
Darko
Guru
Posts: 580
Joined: Fri Nov 11, 2005 9:34 am
Location: Calgary, Canada

Post by Darko »

If you looked around, you would've (eventually) figured out that UVa supports a reduced Java 1.1 (no java.math.*, java.io.* is restricted, that sort of thing...)

Then there is this thing - your file MUST be called Main.java containing a class Main (that MUST NOT be public).

More about it here (note that they don't support a single 1.2 feature, no idea what they mean by that line):
http://acm.uva.es/problemset/java.html
and here:
http://online-judge.uva.es/board/viewtopic.php?t=7429

So, if you are planning to use Java here, I suggest geting 1.1 docs. Yes, Java has come a long way since then, but they have some reason for using it (they actually use gcj 2.95 - I know, I have no idea either).

Darko
Tritri
New poster
Posts: 5
Joined: Mon Mar 06, 2006 2:04 am

Post by Tritri »

I don't know that the file must called Main.java
Now the program compiles, but I get 'Time exceeded limit', supose it's a problem reading input. I will investigate that.

Thanks you Darko.
Tritri
New poster
Posts: 5
Joined: Mon Mar 06, 2006 2:04 am

Post by Tritri »

How can be that:

((Short)stack.peek()).shortValue();


returns compile error, and:

Stack sss = stack;
((Short)sss.peek()).shortValue();

works ??
Darko
Guru
Posts: 580
Joined: Fri Nov 11, 2005 9:34 am
Location: Calgary, Canada

Post by Darko »

Well, you just learned another quirk of the gcj 2.95 :)

So, you know what to look for the next time you get a Compile Error.

Just for heads up - if you get a Wrong Answer, it's not necessarily a wrong answer, it might be a Runtime Error (not reported for Java, and, from what I understand, doesn't get reported for PASCAL either).

Darko
Post Reply

Return to “Java”