簡體   English   中英

嘗試設置 java JVM 堆大小時出現錯誤

[英]I got error when trying to set java JVM heap size

我在 AWS 設備場上運行了一些代碼,這些代碼使 java 堆出 memory 異常。 所以我嘗試在本地運行一些 java JVM 堆設置,看看是否可行。 這是我嘗試過的:

設置 java -Xms262144,我知道這是字節,因此 262144 可能沒有意義,因為太小了,但至少證明這個腳本在語法上是正確的。

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

所以接下來我確實將大小增加到 268435456,即 256Mb,但它似乎根本沒有接受。 請從終端查看下面的 output。

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.

請問有什么提示嗎?

如“使用”中所示,您必須指定 Java class 名稱或 jar 名稱。 例如,

java -Xms256m HelloWorld

在這里而不是 HelloWorld 指定您的 java class 名稱或

java -Xms256m -jar hello.jar

在這里而不是 HelloWorld 指定您的 jar 名稱

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM