错误:找不到或加载主类–Xmx1G
这太疯狂了; 有人看过吗?
java –Xmx1G –Xms1G –XX:+UseG1GC -XX:+PerfDisableSharedMem -jar service-1.0-SNAPSHOT.jarError: Could not find or load main class –Xmx1G
我可以做这个:
java -jar service-1.0-SNAPSHOT.jar –Xmx1G –Xms1G –XX:+UseG1GC -XX:+PerfDisableSharedMem
但jmap -heap {PID}
表明它完全忽略了这些选项。我尝试了不同的变化:
java –XX:+UseG1GC -jar service-1.0-SNAPSHOT.jar –Xmx1G –Xms1G -XX:+PerfDisableSharedMemjava -Xms1G -Xmx1G -jar service-1.0-SNAPSHOT.jar
java –xx:+useg1gc -jar service-1.0-SNAPSHOT.jar
java -server –XX::+UseG1GC -jar service-1.0-SNAPSHOT.jar`
我要么得到此错误: Error: Could not find or load main class {OPTION}
或它运行但忽略选项。
甚至java -XX:-UseConcMarkSweepGC -jar service-1.0-SNAPSHOT.jar
被忽略:
jmap -heap 5879 Attaching to process ID 5879, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.121-b13
using thread-local object allocation.
Parallel GC with 8 thread(s)
Heap Configuration:
MinHeapFreeRatio = 0
MaxHeapFreeRatio = 100
MaxHeapSize = 4294967296 (4096.0MB)
NewSize = 89128960 (85.0MB)
MaxNewSize = 1431306240 (1365.0MB)
OldSize = 179306496 (171.0MB)
NewRatio = 2
SurvivorRatio = 8
MetaspaceSize = 21807104 (20.796875MB)
CompressedClassSpaceSize = 1073741824 (1024.0MB)
MaxMetaspaceSize = 17592186044415 MB
G1HeapRegionSize = 0 (0.0MB)
这是我的JVM:
java -versionjava version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
这发生在我的Mac和Alpine Docker映像中。有什么想法吗?
回答:
应使用连字符减号(U + 002D)时使用破折号(U + 2013)。
–Xmx1G # incorrect: en dash -Xmx1g # correct: hyphen-minus
- https://zh.wikipedia.org/wiki/Dash#Common_dashes
- https://en.wikipedia.org/wiki/Dash#Similar_Unicode_characters
以上是 错误:找不到或加载主类–Xmx1G 的全部内容, 来源链接: utcz.com/qa/397759.html