0

So I am trying to run java rest api on IntelliJ but I have the exception from the title of this question:

Error:(42, 70) java: underscores in literals are not supported in -source 1.6 (use -source 7 or higher to enable underscores in literals)

I am using java 13 and it is on mac.

How can I fix that?

Mohammad
  • 1,549
  • 1
  • 15
  • 27
Tator
  • 125
  • 1
  • 7
  • Please check "Preferences | Build, Execution, Deployment | Compiler | Java Compiler" settings. Probably wrong language level is used for compilation. – y.bedrov Dec 19 '19 at 11:52
  • Does any of the answers in this question help? https://stackoverflow.com/questions/52788743/intellij-error-java-release-version-10-not-supported/58152911#58152911 – Magnilex Dec 19 '19 at 11:52
  • (The cause of course is having literals like `1_000_000`.) – Joop Eggen Dec 19 '19 at 12:04

1 Answers1

0

It sounds that you are using JDK 1.6 instead of 13, that you want

If you run your project using the buttons availables in IntelliJ (play, stop, debug...)

Go to file > project structure and make sure that all of your modules, sources and projects are using java 13:

project SDK

source SDK

dependencies SDK

If you don't have java 13 setted, configure new Java Home pointing to your Java 13 folder:

/Library/Java/JavaVirtualMachines/jdk-13.[your version].jdk/Contents/Home/

If you run your project using terminal, make sure you are using Java 13 by typping:

java -version

UrbanoJVR
  • 1,010
  • 1
  • 7
  • 11