JVM heap size issue in openjdk 8.

Andrew Haley aph at redhat.com
Tue Jul 16 13:21:22 UTC 2019


On 7/16/19 11:31 AM, Pandit (EXT), Vijay wrote:

> Currently my application is compiling using Oracle JDK 7 version and ANT 1.9.5 is used as build tool.
> 
> I need to migrate it to openjdk 8. I had set path to openjdk 8 and when try to build it is giving me error as below :
> 
>      [java] Error: Could not create the Java Virtual Machine.
>      [java] Error: A fatal exception has occurred. Program will exit.
>      [java] Invalid maximum heap size: -Xmx4096M
>      [java] The specified size exceeds the maximum representable size.
> 
> In my ant script I am using as below:
> 
> <jvmarg value="-Xmx4096M" />

Are you sure you're not running a 32-bit JVM? What does java -version say?

It should say this:

openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)

not this:

openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-b04)
OpenJDK Server VM (build 25.212-b04, mixed mode)

-- 
Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671


More information about the discuss mailing list