Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

List example

 
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.
 
Sheriff
Posts: 22017
108
Eclipse IDE Spring VI Editor Chrome Java Ubuntu 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.
 
Ranch Hand
Posts: 37
Hibernate Oracle Java
  • 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.
 
Marshal
Posts: 70636
288
  • 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 Oracle Java
  • 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 Oracle Java
  • 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 Oracle Java
  • 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 Oracle Java
  • 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 Oracle Java
  • 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 Oracle Java
  • 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 Oracle Java
  • 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
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • 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.
 
If you two don't stop this rough-housing somebody is going to end up crying. Sit down and read this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic