Error: use -source 7 or higher

Answered

I'm try to build this MQTT library:

https://github.com/eclipse/paho.mqtt.java

I'm create new maven project and copy org.eclipse.paho.client.mqttv3 files with pom.xml to project and try to build it.

I'm get this error:

Error:(568, 63) java: multi-catch statement is not supported in -source 1.5
(use -source 7 or higher to enable multi-catch statement)

on this line:

 catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) 

I'm try to change compiler setting: (Target bytecode version was 1.5, I'm set it to 11)


But the error has remained.

What setting I'm need to change?

0
2 comments

Hi. Are you using Java 10? Please provide the screenshot of File | Project Structure | Project.

0

Thank all!

I'm solve problem.

In this case all is need to - open "Project Structure Dialog" - press Ctrl+Shift+Alt+S

Next goto Modules and set Language level to 7 (initial setting is 5)

 

0

Please sign in to leave a comment.