"generics are not supported" error

D

Damo

HI All

I get the following error when i try to compile a class with the
following line:

generics are not supported in 1.4

This is the line causing the error.

LinkedList<Result> resultList = new LinkedList<Result>();

I'm using netbeans 5.5 and the jdk version is 1.5, so i dont know
where the error is coming from.
Does anyone know why.
cheers
 
C

Chris Smith

Damo said:
I get the following error when i try to compile a class with the
following line:

generics are not supported in 1.4

This is the line causing the error.

LinkedList<Result> resultList = new LinkedList<Result>();

I'm using netbeans 5.5 and the jdk version is 1.5, so i dont know
where the error is coming from.

Check your project settings in NetBeans. The Java compiler has command
line options to specify which version of the language spec is used for
compiling code. If you have the project accidentally set to Java 1.4,
then it's quite possible that having a 1.5 JDK doesn't matter because
NetBeans is passing "-source 1.4" as a command line argument.
 
L

Lew

Damo said:
HI All

I get the following error when i try to compile a class with the
following line:

generics are not supported in 1.4

This is the line causing the error.

LinkedList<Result> resultList = new LinkedList<Result>();

I'm using netbeans 5.5 and the jdk version is 1.5, so i dont know
where the error is coming from.
Does anyone know why.
cheers

Check the Netbeans project "properties" (right-click on the project name in
the "Projects" window and select "Properties").

Look at the "Sources" category and take a peek at the "Source _L_evel" - is it
at least "1.5"?

- Lew
 
A

Alexander Schoelling

Damo:
generics are not supported in 1.4

This is the line causing the error.

LinkedList<Result> resultList = new LinkedList<Result>();

I'm using netbeans 5.5 and the jdk version is 1.5, so i dont know
where the error is coming from.

Hi Damo,

the most probable reason is that the project is configured to compile
for Java 1.4. The setting can be changed from the project properties
dialog (Check the bottom of the source part, there is a drop-down list
labeled "Source Level" where you must select at least 1.5).

Yours,

Alexander
 
D

Damo

Cheers people,
It was accidently set to 1.4.
You saved me a lot of time trying to find something daft like that!!!
 
Joined
Oct 17, 2007
Messages
1
Reaction score
0
Thanks

Thank you very much. I am on a very tight deadline now. This saved me a lot of time. :
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top