Search code examples
javamavenjava-10

Maven not running with Java 10: Files\Java\jdk-10""=="" was unexpected at this time


I'm trying to upgrade my application to Java 10, so, I installed the JDK and set JAVA_HOME:

C:\Users\pupeno\app>echo %JAVA_HOME%
"c:\Program Files\Java\jdk-10"

C:\Users\pupeno\app>%JAVA_HOME%\bin\javac.exe --version
javac 10

but no matter what I try to do with Maven, I get the same error:

C:\Users\pupeno\app>mvn package
Files\Java\jdk-10""=="" was unexpected at this time.

C:\Users\pupeno\app>mvn --help
Files\Java\jdk-10""=="" was unexpected at this time.

C:\Users\pupeno\app>cd ..

C:\Users\pupeno>mvn --help
Files\Java\jdk-10""=="" was unexpected at this time.

What does that error mean? What's going on? How do I fix it?


Solution

  • The messages start with "Files\Java\jdk-10" which seems to indicate you have not quoted your JAVA_HOME correctly. The correct syntax would be something like

    set "JAVA_HOME=c:\Program Files\Java\jdk-10"
    set "PATH=%JAVA_HOME%\bin;%PATH%"
    

    And then

    java -version
    

    should function without specifying additional arguments on the command line (as should maven).