tags:

views:

208

answers:

2

I ran:

javac Perf.java

and got:

ERROR in Prefs.java (at line 36)

HashMap<String, String> map = new HashMap<String, String>();
        ^^^^^^^^^^^^^^
Syntax error, parameterized types are only available if source level is 1.5

When I type: java -version I get:

java version "1.6.0_0"
IcedTea6 1.4 (fedora-11.b14.fc10-i386) Runtime Environment (build 1.6.0_0-b14)
OpenJDK Client VM (build 14.0-b08, mixed mode)

javac -version gets me:

Eclipse Java Compiler 0.883_R34x, 3.4.1 release, Copyright IBM Corp 2000, 2008. All rights reserved.

This is a fresh install of Fedora 10. What is this icedtea business? Why is the Java compiler defaulting to the Eclipse compiler? Someone explain this madness...

+1  A: 

Check your $PATH variable. It sounds like your "java" executable is in one place and the "javac" is somewhere else.

Try the "where" or "which" command on the command line - this will tell you where the shell/OS is locating each of these executables:

which java
which javac
Andy White
Both are in the same location: /usr/bin/java[c| ]
windfinder
You may need to (re)download the Java SDK then. It sounds like your OS shipped with a strange/non-standard version of javac
Andy White
redhat fedora 10 has been 90% fail so far
windfinder
oh man... that blows :(. I've never had much luck with the preinstalled versions of java. I always like to just download the latest JDK so I know exactly what I'm dealing with.
Andy White
Sigh... one day there will be a version of linux I am impressed with. That day is not today.
windfinder
The version of java / javac installed by default on Fedora is actually based on gcj. It's a native compiler, not a JVM, designed to provide basic compatibility. You should get the OpenJDK or the Sun standard version instead.
Varkhan
If you really want a Unix with good Sun Java support pr default, use OpenSolaris. The latest release is quite good.
Thorbjørn Ravn Andersen
A: 

Fedora as default use Open Source software. Icedtea is the redhat adaptation of the OpenJDK to be fully open source. The Eclipse compiler is the best open source command line java compiler out there, but it appears not to be compiling for Java 6 per default.

Try "javac -help" to see what options you have. It may be just a simple environment variable which needs tweaking.

Thorbjørn Ravn Andersen