2

How can I fix these java language level error which shows:

use -source 7 or higher to enable strings in switch

I am using netbeans as an IDE.

Jacq
  • 21
  • 1
  • 2
    Hello there.. Welcome to Stack Overflow. I think you should take some time to read on [How to ask a good question around here](https://stackoverflow.com/help/how-to-ask) and take some time to improve this question.. :) – Romeo Sierra Feb 11 '20 at 01:54
  • Look at the JDK currently used by Netbeans and you might need an update. Or else can you post more on the error? – Lokesh A. R. Feb 11 '20 at 02:13
  • Are you using maven? If so use [this](https://stackoverflow.com/a/18420462/1540468). Which will work as long as a jdk 7 is installed. – Paul Rooney Feb 11 '20 at 04:56
  • If you are not using Maven, you can manually set the source Java version in Project Properties > Sources > Source/Binary Format dropdown. But as Paul says, the use Maven .pom if you are in a Maven project! – BadZen Feb 11 '20 at 06:18

1 Answers1

1

With right mouse click on a project name open pop-up menu and choose "Properties". There will be project properties window opened. Choose category "Sources" and change field "Source/Binary Format":

Netbeans Project Properties

If you have several JVM versions installed, choose the necessary version under "Build/Compile":

enter image description here

Daniil
  • 913
  • 8
  • 19