











I'm trying to use IntelliJ (on Mac OS X) to compile some code I wrote using Eclipse. I've attempted to run the following code:
switch (category) {
case "below 20":
below20 ;
break;
case "20 to 29":
to30 ;
break;
case "30 to 39":
to40 ;
break;
case "40 to 49":
to50 ;
break;
case "50 to 59":
to60 ;
break;
case "60 to 69":
to70 ;
break;
case "70 t0 79":
to80 ;
break;
case "80 to 89":
to90 ;
break;
case "90 to 99":
above90 ;
break;
default:
break;
}
However, I get the error:
java: strings in switch are not supported in -source 1.6
(use -source 7 or higher to enable strings in switch)
I know that some of the answers will be: RTFE (i.e. replace Manual with Error). But I did. I've attempted the following:
-source 7
and/or -target 1.7
to Additional command line parameters/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home
And it hasn't fixed it. What am I doing wrong?
Note: I know this is obvious because the directory is above, but I do have Java 7 installed.
Thanks in advance!
At the Intellij IDEA you should also go to Project Settings
-> Project
and set appropriate Project language level
there