How to use -source in IDEA

263 views Asked by At

How can I fix this? When I trying to compile some code, I get this message:

java: diamond operator is not supported in -source 1.6
  (use -source 7 or higher to enable diamond operator)


On my PC I have this settings and I using IDEA:

C:\Windows\System32>javac -version
javac 1.7.0_25

C:\Windows\System32>java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

What exactly should I do to compile it? Where should I place '-source 7'?

1

There are 1 answers

2
Anthony Benavente On BEST ANSWER

Go to your project structure menu (ctrl+alt+shift+s) and change your "Project Language Level" to "7.0 Diamonds, ARM, multi-catch, etc.". It's under the Project tab in your sidebar to the left.