重复的Java运行时选项:首选顺序是什么? [英] Duplicated Java runtime options : what is the order of preference?
本文介绍了重复的Java运行时选项:首选顺序是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
考虑以下命令行
java -Xms128m -Xms256m myapp.jar
哪些设置适用于JVM最小内存( Xms
选项):128m或256m?
Which settings will apply for JVM Minimum memory (Xms
option) : 128m or 256m ?
推荐答案
取决于JVM,可能是版本......甚至可能是你当时桌面上有多少纸夹。它可能甚至不起作用。不要这样做。
Depends on the JVM, perhaps the version...perhaps even how many paper clips you have on your desk at the time. It might not even work. Don't do that.
如果由于某种原因它不在您的控制范围内,请按照运行jar的方式编译和运行它。但要注意,依赖选项的顺序是一个非常糟糕的主意。
If it's out of your control for some reason, compile and run this the same way you'd run your jar. But be warned, relying on the order of the options is a really bad idea.
public class TotalMemory
{
public static void main(String[] args)
{
System.out.println("Total Memory: "+Runtime.getRuntime().totalMemory());
System.out.println("Free Memory: "+Runtime.getRuntime().freeMemory());
}
}
这篇关于重复的Java运行时选项:首选顺序是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文