• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java 1.5 compile time error

 
Anjali S Sharma
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a class that one of my team members have written in J2se 1.5
While it is working on her machine it is giving the following compile time error is other machines (using J2se 1.5)

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

this error is coming at the very first line (package declaration) of the class.

Can someone please let me know what the problem could be and how to resolve it.

We are using eclipse 3.2.2
Code for the class is
[edit]Remove some whitespace to shorten lines. CR[/edit]
[ November 14, 2008: Message edited by: Campbell Ritchie ]
 
rakesh sugirtharaj
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suppose the class itself has nothing to do with the error. If you are trying to sort using a comparable, check its implementation.
 
Maneesh Godbole
Saloon Keeper
Posts: 11165
14
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Anjali S Sharma:
While it is working on her machine it is giving the following compile time error is other machines (using J2se 1.5)
...
We are using eclipse 3.2.2


What compliance level have you set on Eclipse?
 
Anjali S Sharma
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Maneesh Godbole:


What compliance level have you set on Eclipse?


Thanks for replying.
Are you referring to "Profile Compliance and Validation" under Project-->Properties.
It has two drop downs
1. WS-I AP compliance level: value for this is Follow Preference
2. WS-I SSBP compliance level: value for this is Follow Preference

Do I need to change these values?
 
Maneesh Godbole
Saloon Keeper
Posts: 11165
14
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Anjali S Sharma:

Are you referring to "Profile Compliance and Validation" under Project-->Properties.


No.
My bad. I should have been more explicit.
I meant Project->Properties->Java Compiler->JDK Compliance.
 
Anjali S Sharma
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Maneesh Godbole:


No.
My bad. I should have been more explicit.
I meant Project->Properties->Java Compiler->JDK Compliance.


Compiler compliance level is "5.0"
Also, check box with label "Use default compliance settings" is also checked.
Thanks
 
Maneesh Godbole
Saloon Keeper
Posts: 11165
14
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Strange.
Try turning off Generic warnings by eclipse.
 
Bill Shirley
Ranch Hand
Posts: 457
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
provide the full text of the actual error
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a possibly corrupted install; as if a 5.0 compiler is using an rt.jar from an older release.
 
Anjali S Sharma
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bill Shirley:
provide the full text of the actual error


Eclipse only shows this error
"The type Comparable is not generic; it cannot be parameterized with arguments <String>"
 
Rob Spoor
Sheriff
Pie
Posts: 20659
64
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like you're compiling against a 1.4 JRE. Try changing that in your project properties to a 1.5 or higher version.
 
ajju Krishnamurthy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
on Eclipse,
windows -->preferences -->java->> Installe jre s -
Select the jre and set the jre5.0 over there.

Hope this will help you.

Regards
Ajay Krishnamurthy
 
Anjali S Sharma
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ajju Krishnamurthy:
on Eclipse,
windows -->preferences -->java->> Installe jre s -
Select the jre and set the jre5.0 over there.

Hope this will help you.

Regards
Ajay Krishnamurthy


It is already showing 1.5.0_15 as checked. Infact this is the only option available
 
Maneesh Godbole
Saloon Keeper
Posts: 11165
14
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try turning off the generic warnings as I suggested?
 
Anjali S Sharma
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Maneesh Godbole:
Strange.
Try turning off Generic warnings by eclipse.


Where can I find this option?
 
Campbell Ritchie
Sheriff
Pie
Posts: 50168
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
R-click project->properties->Java Compiler->Warnings.

But I don't think the error you are getting is covered by the warnings available for changing.
 
Vaibhav Jaiswal
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Anjali S Sharma:

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

this error is coming at the very first line (package declaration) of the class.

[ November 14, 2008: Message edited by: Campbell Ritchie ]


You sure the problem is in this file I could not find any Comparable being used or imported in the code.
 
Andrew Fitzpatrick
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I just got exactly the same problem and managed to fix it.

The problem is classpath related and to do with the order of jar and class files. To solve right click on the project in Eclipse and select properties, click the Order and Export tab. Now use the buttons on the right hand side to move the java runtime up so that it appears before all library jar files, ensure your project files still precede this library though.

A refresh on the project should see it rebuilt without issue.
 
Jae Lim
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andrew Fitzpatrick wrote:Hi, I just got exactly the same problem and managed to fix it.

The problem is classpath related and to do with the order of jar and class files. To solve right click on the project in Eclipse and select properties, click the Order and Export tab. Now use the buttons on the right hand side to move the java runtime up so that it appears before all library jar files, ensure your project files still precede this library though.

A refresh on the project should see it rebuilt without issue.


Thanks for posting your solution Andrew! I had the same problem and your solution worked like a charm.
 
Satya Maheshwari
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andrew Fitzpatrick wrote:Hi, I just got exactly the same problem and managed to fix it.

The problem is classpath related and to do with the order of jar and class files. To solve right click on the project in Eclipse and select properties, click the Order and Export tab. Now use the buttons on the right hand side to move the java runtime up so that it appears before all library jar files, ensure your project files still precede this library though.

A refresh on the project should see it rebuilt without issue.


Excellent!! Thanks so much!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic