• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java 1.5 compile time error

 
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Strange.
Try turning off Generic warnings by eclipse.
 
Ranch Hand
Posts: 457
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
provide the full text of the actual error
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>"
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Maneesh Godbole:
Strange.
Try turning off Generic warnings by eclipse.



Where can I find this option?
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic