Search code examples
javaicedtea

Why does IcedTea6 not compile Java 1.5 specific code?


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...


Solution

  • 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