How to fix Java language level error in Intellij? – User friendly Tech help

Error:-
n java: strings in switch are not supported in -source 1.5
n  (use -source 7 or higher to enable strings in switch)
n
n

n

Solution:-
nWhy this error, as we are trying to access feature of java(in our case switch statements) using java 1.5 which is actually supported in higher version of java (7 in our case).
n
nIDE used is Intellij.
n
nStep1:-
nFile > Project Structure >Project > Project language level
nChange this to 1.7 or higher
n
nStep2:-
nFile > Project Structure > Modules > Select the module > language level
n
n
Step3:-
nFile > settings > Java Compiler > change to latest compiler

nn

nRerun the project, hope it will work fine 🙂
n
nLearn Selenium
n

Was this article helpful?
YesNo

Similar Posts