• Post Reply Bookmark Topic Watch Topic
  • New Topic

List example  RSS feed

 
orgil khatanbaatar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


This is giving error that says: type List does not take parameters
Why? It was working fine on IDE.
 
Rob Spoor
Sheriff
Posts: 21133
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure you're using a 5.0, 6 or 7 JDK. You're probably using a 1.4 JDK, and generics weren't available for Java 1.4.
 
Shinil Mohan
Ranch Hand
Posts: 37
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you check the version of Java you use to compile the code. Can you try to use the same version of Java you used in the IDE and try to compile once.
 
orgil khatanbaatar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got jre6, jdk1.6.0_11 in C:\Program Files (x86)\Java folder. I dont know how to check which java version Netbeans 6.5 is running but it is on same machine.
 
Campbell Ritchie
Marshal
Posts: 56529
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should be able to work out the java version from NetBeans because there is an option to set the version for the project. But I can't remember how to do it.

The error is a compiler error, so you should look at which version is being compiled. Try both these instructions at the command line:-
javac -version
java -version
 
Shinil Mohan
Ranch Hand
Posts: 37
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use below blog to find/change the Java version in NetBeans

http://blogs.oracle.com/charliebrown/entry/how_to_set_and_use
 
orgil khatanbaatar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I checked out through the title's instruction provided above. I see "Java Platform: JDK1.6(default)" on Netbeans.
 
Shinil Mohan
Ranch Hand
Posts: 37
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is good, that is why you are able to get the code compile with out any issue with IDE. Can you also check the version of Java in command line as Campbell Ritchie suggested. Check if you are using 1.5 or above, else point your Java accordingly and test again.
 
orgil khatanbaatar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, I did as Campbell Ritchie suggested and then I got "java version 1.6.0_11".
 
Shinil Mohan
Ranch Hand
Posts: 37
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tested the code and was able to compile the same code in command line with out any error in my machine. Can you compile the code once again in command line with "javac" and see if you get the same error again, if so can you share a screen short or steps you follow to compile and run your code.
 
orgil khatanbaatar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Shinil Mohan
Ranch Hand
Posts: 37
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are getting one more error "reached end of file while parsing"
Can you just see why that error is coming up and clean that error and try.
This error will come when you have some bracket closing issue with code.
 
orgil khatanbaatar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes. but that error occurred previously and fixed that. Finally i got "type List does not take parameters".
 
Shinil Mohan
Ranch Hand
Posts: 37
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While testing for better understanding you can remove the commented code from the class file.
 
Shinil Mohan
Ranch Hand
Posts: 37
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
orgil khatanbaatar wrote:yes. but that error occurred previously and fixed that. Finally i got "type List does not take parameters".


Then it will be easy if you share the latest code always. Also try to give the java -version out put also next time.
 
Shinil Mohan
Ranch Hand
Posts: 37
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Below code is working fine in my machine in IDE and command line with JDK 1.7, Class file is getting created correctly

 
orgil khatanbaatar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have compiled with no problem then my jdk is not running properly. No doubt version was 1.6
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can confirm this error with JDK javac 1.6.0_26 on Linux, and got rid of the error with deleting all classfiles in that directory.

I don't have a JDK-1.4 since about 5 years.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!