We help IT Professionals succeed at work.

Error due to not being Java source level 5

jwright9
jwright9 asked
on
Medium Priority
791 Views
Last Modified: 2012-06-27
I have some code that I took over and this line:

Vector <Report> reports = new Vector<Report>();

is give me an error of:

Syntax error, parameterized types only available if source level is 5.0

Do I need a particular library (jarfile)?
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2016
Commented:
Suggests that your IDE has to be 'turned' up to 1.5. What is it?

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Commented:
While compiling the file, you need to use -source 1.5 switch
How are you compiling the application? If you are using eclipse
or similar, there is an option in the project properties where you can
set this.

I'm not sure if it's -source 1.5 or -source 5.0

________
radarsh
CERTIFIED EXPERT
Top Expert 2016

Commented:
>>I'm not sure if it's ...

The former. But this looks more like an IDE message ...

Commented:
CEHJ, you're right. I checked in eclipse and the error message is identical.

jwright9, you can go to the properties of your project -> Java Compiler
There, select 5.0 in "Compiler Compliance Level" list down. If your options
are disabled, check "Enable Project Specific Settings".

You can do the same in Window -> Preferences

________
radarsh
CERTIFIED EXPERT
Top Expert 2016

Commented:
:-)
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.