javasyntax

Java compiler complains about perfectly valid syntax


reifnsk/minimap/ReiMinimap.java:68: error: '.' expected
import ro;
         ^
reifnsk/minimap/ReiMinimap.java:68: error: ';' expected
import ro;
          ^
reifnsk/minimap/ReiMinimap.java:69: error: class, interface, or enum expected
import sb;
       ^

I get one of these for most of my import statements, yet its all syntactically good.

Full error: http://bit.ly/1eZ5l0h Files snapshot: http://bit.ly/1eSXMdE File is more or less closed source, but most of the problems are just with import statements and switch statements.


Solution

  • You are trying to import classes in the default package from a class in a named package. This will not work (at least without reflection). In order to use them, imported classes have to be placed in a named package or the class itself should be placed into the default package.

    See the answer about such imports for more information.