Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

1.3K
Vistas
Java 17 with Maven Wrapper results in Unrecognized VM option 'MaxPermSize=512m'

I use OpenJDK 17 with Maven Wrapper 3.8.2 from Spring Initializr (Maven project, JAR packaging, Java 17, Spring Boot 2.6.0). No additional dependencies.

user@DESKTOP-U2OU5HG MINGW64 /c/Projects/my-project (master)
$ java -version
openjdk version "17" 2021-09-14
OpenJDK Runtime Environment (build 17+35-2724)
OpenJDK 64-Bit Server VM (build 17+35-2724, mixed mode, sharing)

Upon running any of ./mvnw.cmd -version or ./mvnw.cmd clean install, I always get the following message:

Unrecognized VM option 'MaxPermSize=512m'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Switching to OpenJDK 16.0.2 resolves the issue, however, I need to work with Java 17.

How to get it run? There is nowhere MaxPermSize=512m set.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Indeed -XX:MaxPermSize=size is labelled as follows according to Java® Development Kit Version 16/17 Tool Specifications (see the links):

  • For Java 16 it is obsolete.
  • For Java 17 it is removed.

The Maven Wrapper in the mvnw.cmd script, however, aside from the required JAVA_HOME, uses also a bunch of optional environment variables such as M2_HOME and these starting with MAVEN_ prefix.

The important one is MAVEN_OPTS where such a removed Java option can appear causing the inability to start the JVM on the newer version. In my case, I had something like:

MAVEN_OPTS="-Xmx4g -XX:MaxPermSize=512m -Dfile.encoding=UTF-8 -Djavax.xml.accessExternalSchema=all"

The solution is either to remove the option from the environment variables or add this line to the Maven Wrapper script to override the MAVEN_OPTS value, In the minimal form:

MAVEN_OPTS=
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda