"Cannot switch on a value of type String for source level below .." error in Eclipse

Viewed 73045

I am using Eclipse to develop a Java program. I had to downgrade JRE and JDK from 1.7x to 1.6. Now everything is pointing to 1.6.x (including the installed JRE and JDK compliance).

But now Eclipse still gives me an error on the switch statement, indicating:

Cannot switch on a value of type String for source level below 1.7. Only convertible int values or enum constants are permitted

on the code below:

Switch("test") // Which is fine with 1.7.x

I removed 1.7.x from computer, not sure why it is still looking for 1.7 instead of 1.6?

7 Answers

change both your jdk and compiler compliance level: enter image description here

Related