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

HOW TO FIX IT:

It is because eventhough you have Java 5 installed, the JVM running may be different.

Try typing this in the console window: java -version.
It will give you the Version of the Runtime Environment.

Or, if you are using an IDE, then you need to enable Java 5 support.
In Eclipse, You can add Java 5 in Window > Preferences > Java > Installed JRE’s.
and/or, Set the compiler compliance level to 5.0 (Window > Preferences > Java > Compiler)

In Netbeans, you can use (Tools -> Java Platform Manager) to check your default platform.

5 Responses to “Syntax error, parameterized types are only available if source level is 5.0”


  1. 1 Stardust May 10, 2008 at 1:47 pm

    Thank you verrrrry much! This helped me after looong observing what is different at me that tutorials dont work at me :D

    Michel

  2. 2 Mike August 29, 2008 at 6:21 pm

    I had 1.6 installed. I thought I had to install 5.0 to make it work, but I just had to up the compliance level. Not too bad, but a pain to figure out the obscure setting.

  3. 3 robust February 4, 2009 at 9:12 pm

    hi thank you very mcuh for the solution. this kept stick to my chair for more time and have my work progress

  4. 4 Robert Christian June 16, 2009 at 11:54 pm

    I am running into this issue on Websphere Application server. IBM has their own JDK and uses Eclipse libraries at build time. The IBM JDK is per 1.6, yet the following is thrown when I introduce a String-parameterized set:

    com.ibm.ws.jsp.JspCoreException: JSPG0049E: /regress_all.jsp failed to compile :
    JSPG0091E: An error occurred at line: 18 in the file: /regress_all.jsp
    JSPG0093E: Generated servlet error from file: /foo.jsp
    c:\…\foo.java : 92 : Syntax error, parameterized types are only available if source level is 5.0
    JSPG0091E: An error occurred at line: 19 in the file: /foo.jsp
    JSPG0093E: Generated servlet error from file: /foo.jsp
    c:\…\foo.war\_ibmjsp\foo.java : 93 : Syntax error, ‘for each’ statements are only available if source level is 5.0
    JSPG0091E: An error occurred at line: 24 in the file: …

    Turns out that the latest release (it’s June 2009) precompiles jsps with 1.3 compatibility by default!

    I found some enlightenment here:

    http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/topic/com.ibm.websphere.express.doc/info/exp/ae/uweb_jspcompile.html?resultof=%22%6a%73%70%22%20%22%63%6f%6d%70%69%6c%65%22%20%22%63%6f%6d%70%69%6c%22%20

  5. 5 sirimch November 3, 2009 at 1:37 am

    thanx yaar..i was struggling fr 2 days to find out the problem..finally saw ur site and my problem gt resolved


Leave a Reply