Calum
Calum

Reputation: 2130

The type JList is not generic; it cannot be parameterized with arguments <String>

I have a project that runs in eclipse on linux, i have moved a copy of it to jbuilder on windows and have run into a few issues.

I get the following error:

The type JList is not generic; it cannot be parameterized with arguments <String>

for this line of code:

private JList<String> songListView;

I have various other issues all of which seem to be related to swing. Is there a particular library i need to import?

Upvotes: 1

Views: 3305

Answers (3)

Alpesh Gediya
Alpesh Gediya

Reputation: 3794

Generic Jlist introduced in JDK 7 while in case of older version this feature was not availible.

Point your eclipse to JDK 7 and your issue will be resolved.

Upvotes: 0

Reimeus
Reimeus

Reputation: 159844

Generics were introduced to the JList class in Java 7. You are most likely using JDK version 6 or under. Upgrade to JDK 7.

Upvotes: 1

Thihara
Thihara

Reputation: 6969

JList was not retrofitted with generics until Java SE 7.

You must still be using Java SE 6.

Upvotes: 5

Related Questions