0

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?

pupeno
  • 256,034
  • 114
  • 324
  • 541
  • Just in case, the original linked question(i.e. setting correct JAVA_HOME) doesn't help, please feel free to update the question and reopen it. – Naman Apr 06 '18 at 17:49

2 Answers2

4

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).

Elliott Frisch
  • 183,598
  • 16
  • 131
  • 226
2

The quotes shouldn't be part of the JAVA_HOME value. You can try following in Windows terminal to confirm it:

set JAVA_HOME=c:\Program Files\Java\jdk-10
mvn --help
Karol Dowbecki
  • 38,744
  • 9
  • 58
  • 89