Can you check the version of Java you use to compile the code. Can you try to use the same version of Java you used in the IDE and try to compile once.
I got jre6, jdk1.6.0_11 in C:\Program Files (x86)\Java folder. I dont know how to check which java version Netbeans 6.5 is running but it is on same machine.
You should be able to work out the java version from NetBeans because there is an option to set the version for the project. But I can't remember how to do it.
The error is a compiler error, so you should look at which version is being compiled. Try both these instructions at the command line:-
This is good, that is why you are able to get the code compile with out any issue with IDE. Can you also check the version of Java in command line as Campbell Ritchie suggested. Check if you are using 1.5 or above, else point your Java accordingly and test again.
I tested the code and was able to compile the same code in command line with out any error in my machine. Can you compile the code once again in command line with "javac" and see if you get the same error again, if so can you share a screen short or steps you follow to compile and run your code.
You are getting one more error "reached end of file while parsing"
Can you just see why that error is coming up and clean that error and try.
This error will come when you have some bracket closing issue with code.