搜尋此網誌

2016年1月6日 星期三

NetBean遇到的問題與解法

錯誤訊息: 在使用switch指令時發生下列錯誤

java: strings in switch are not supported in -source 1.6
  (use -source 7 or higher to enable strings in switch)
解法
  • Preferences > Compiler > Java Compiler and added -source 7 and/or -target 1.7 toAdditional command line parameters
  • Edit Configurations: checked Use Alternative JDK and wrote in the directory /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home
http://stackoverflow.com/questions/22481103/intellij-switch-statement-using-strings-error-use-source-7