wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Java 1.5 compile time error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java 1.5 compile time error" Watch "Java 1.5 compile time error" New topic
Author

Java 1.5 compile time error

Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
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

Joined: Dec 16, 2007
Posts: 151
I suppose the class itself has nothing to do with the error. If you are trying to sort using a comparable, check its implementation.


Cheers!
RSR
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10172
    
    8

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?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
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

Joined: Jul 26, 2007
Posts: 10172
    
    8

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

Joined: Jun 29, 2005
Posts: 279
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

Joined: Jul 26, 2007
Posts: 10172
    
    8

Strange.
Try turning off Generic warnings by eclipse.
Bill Shirley
Ranch Hand

Joined: Nov 08, 2007
Posts: 457
provide the full text of the actual error


Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Sounds like a possibly corrupted install; as if a 5.0 compiler is using an rt.jar from an older release.


[Jess in Action][AskingGoodQuestions]
Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
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

Joined: Oct 27, 2005
Posts: 19655
    
  18

Looks like you're compiling against a 1.4 JRE. Try changing that in your project properties to a 1.5 or higher version.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
ajju Krishnamurthy
Greenhorn

Joined: Nov 14, 2008
Posts: 4
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

Joined: Jun 29, 2005
Posts: 279
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

Joined: Jul 26, 2007
Posts: 10172
    
    8

Did you try turning off the generic warnings as I suggested?
Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
Originally posted by Maneesh Godbole:
Strange.
Try turning off Generic warnings by eclipse.


Where can I find this option?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38045
    
  22
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

Joined: Jan 17, 2008
Posts: 12
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

Joined: Oct 26, 2009
Posts: 1
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

Joined: Feb 20, 2009
Posts: 12
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

Joined: Jan 01, 2007
Posts: 368
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!!


Thanks and Regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java 1.5 compile time error
 
Similar Threads
What is -Xlint in compiling java program?why this is done?
Local Entity Bean not bound in EJB 2.1 on JBoss 4.2.3 server
Exception: Server redirected too many times (20)
Stored proc not found...
Testing with Database connections - help needed