0

I have some code running on AWS device farm, that got java heap out of memory exception. So I tried to run some java JVM heap settings locally to see if that works. Here is what I tried:

set java -Xms262144, I know that is in byte, thus 262144 probably doesn't make sense, as too small, but at least that proves this script is correct in syntax.

C02ZxxxGVCF:util i7xxxx$ java -Xms262144
Error occurred during initialization of VM
 Too small initial heap

So next I did increase the size to 268435456 which is 256Mb, but it doesn't seem to take that at all. Please see below output from terminal.

C02ZxxxGVCF:util i7xxxxx$ java -Xms268435456
Usage: java [options] <mainclass> [args...]
           (to execute a class)
   or  java [options] -jar <jarfile> [args...]
           (to execute a jar file)
   or  java [options] -m <module>[/<mainclass>] [args...]
       java [options] --module <module>[/<mainclass>] [args...]
           (to execute the main class in a module)
   or  java [options] <sourcefile> [args]
           (to execute a single source-file program)

 Arguments following the main class, source file, -jar <jarfile>,
 -m or --module <module>/<mainclass> are passed as the arguments to
 main class.

Any tips please?

Huibin Zhang
  • 1,072
  • 1
  • 15
  • 30

1 Answers1

0

As shown in the "Usage", you must specify the Java class name or the jar name. For example,

java -Xms256m HelloWorld

Here instead of HelloWorld specify your java class name or

java -Xms256m -jar hello.jar

Here instead of HelloWorld specify your jar name

Roopashree
  • 140
  • 8