2

this bit of code gives me the error message: "Syntax error on token "module", interface expected. Does anyone know why?

module TeaThiever{
}
greg-449
  • 109,219
  • 232
  • 102
  • 145
Lucas Wedel
  • 31
  • 1
  • 1
  • 2

2 Answers2

4

The module statement is only valid in a module-info.java file and it must be used with Java 9 or above.

In Eclipse set the 'Compiler compliance level' on the project 'Java Compiler' properties page to be Java 9 or above (you also need to have a suitable Java installed).

greg-449
  • 109,219
  • 232
  • 102
  • 145
0

Modules were added in Java 9. You need to update your JDK. I recommend you use Java 11.

Project -> Propertes -> Java Build Path -> Libraries -> Add Lbrary -> JRE System Library -> Execution environment -> JavaSE-11(jre).