(use -source 7 or higher to enable strings in switch) error;Netbeans 7.1.2

You need to set the source for your project,

right click > properties > source > set here


In general on "-source 7": use JDK7

(For example if you are normally using JDK 6 and just want to use JDK 7 for a special project etc.)

If you still have problem to use a different JDK in Netbeans, the following steps may help.

First, install JDK to any directory, it does not have to be your main JDK or entered to any PATHS or so.

All these steps must be regarded

In Netbeans, right-click on the project -> Properties

  1. -> Libraries -> Manage Platforms... -> Add Platform... and add your JDK directory
  2. -> Libraries -> Java Platform: select JDK 7
  3. -> Sources -> Source/Binary Format: select JDK 7