Syntax error, parameterized types are only available if source level is 1.5

I recently installed Eclipse and all of a sudden my Java applications failed to build with the error:

Syntax error, parameterized types are only available if source level is 1.5

After a bit of Googling I figured out that Eclipse installed a different JVM and set it as the default one.   On Ubuntu (at least) the way to change the default JVM is by typing this into the console:

sudo update-alternatives --config java

It will show you which JVM is currently selected and allow you to choose a different one as default.

This entry was posted in Java and tagged , , , , , , . Bookmark the permalink.

5 Responses to Syntax error, parameterized types are only available if source level is 1.5

  1. Nick says:

    It seems installing Eclipse was a really bad idea. I’ve been getting more cryptic messages from the Java compiler, so I tried javac -v and low and behold it’s a special Eclipse flavour of the compiler. Running this seemed to help:

    sudo update-java-alternatives -s java-6-sun

    Now I have the Sun compiler back, but I am wondering how many other skeletons Eclipse has left in the wardrobe.

  2. rumana says:

    To solve the same,

    right click on ur eclipse project -> properties->javacompiler->

    select “Enable project specific settings”, change to 1.5 in”compiler compliance level” and apply and rebuild the project.

  3. Zaya says:

    Rumana ! Thank u so so so so so much!!!!!!:D

  4. Ravi says:

    This is helpful. Thank u so much Rumana

  5. Ashwin says:

    @rumana : Thank you very much .

Leave a Reply

Your email address will not be published. Required fields are marked *