Fix: Maven command in Windows returns a Java hint

Environment:

  • Windows Server 2012 R2

  • Apache Maven 3.6.0

When I run any maven command (whatever), I always get the following answer

Usage: java [-options] class [args...] (to execute a class) or java [-options] -jar jarfile [args...] (to execute a jar file)

Before removing C:\.mvn folder

This happens if you have .mvn folder in the system volume (C:\). Removing C:\.mvn will fix this error.

After removing C:\.mvn folder

References