Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change from -source 1.6 to -source 7 in IntelliJ IDEA

I' trying to build a in IntelliJ IDEA project that is not mine and I got the following error:

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

How do I change this setting in IntelliJ IDEA?

like image 906
El Marce Avatar asked Feb 03 '14 15:02

El Marce


People also ask

How do I change the source level in IntelliJ?

From the main menu, select File | Project Structure Ctrl+Alt+Shift+S . Under Project Settings, select Modules | Sources. From the Language level list, select the necessary option. To use the project language level, select Project default.

How do I change properties in IntelliJ?

To configure project settings, select IntelliJ IDEA | Preferences on macOS or File | Settings on Windows and Linux from the main menu. Alternatively, you can press Ctrl+Alt+S to show the IDE settings. icon. Other settings are global and apply to all existing projects.


2 Answers

Ctrl+Alt+Shift+S (Project Structure icon)

Then change Project language level

like image 132
Ori Dar Avatar answered Sep 24 '22 11:09

Ori Dar


I know the OP uses IntelliJ IDEA, but Android Studio is based on IntelliJ IDEA, so I wanna say one more word.

If you use Android Studio, command+;(for Mac) or File->Project Structure, then in the open window follow the settings:

enter image description here

like image 26
Allen Avatar answered Sep 22 '22 11:09

Allen