java - IntelliJ switch statement using Strings error: use -source 7 -


i'm trying use intellij (on mac os x) compile code wrote using eclipse. i've attempted run following code:

switch (category) {     case "below 20":         below20++;         break;     case "20 29":         to30++;         break;     case "30 39":         to40++;         break;     case "40 49":         to50++;         break;     case "50 59":         to60++;         break;     case "60 69":         to70++;         break;     case "70 t0 79":         to80++;         break;     case "80 89":         to90++;         break;     case "90 99":         above90++;         break;     default:         break; } 

however, error:

java: strings in switch not supported in -source 1.6   (use -source 7 or higher enable strings in switch) 

i know of answers be: rtfe (i.e. replace manual error). did. i've attempted following:

  • preferences > compiler > java compiler , added -source 7 and/or -target 1.7 additional command line parameters
  • edit configurations: checked use alternative jdk , wrote in directory /library/java/javavirtualmachines/jdk1.7.0_51.jdk/contents/home

and hasn't fixed it. doing wrong?

note: know obvious because directory above, i have java 7 installed.

thanks in advance!

at intellij idea should go project settings -> project , set appropriate project language level there


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -