Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.3K
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!