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 运行时选项:优先顺序是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:重复的 Java 运行时选项:优先顺序是什么?
基础教程推荐
- 将 Windows 证书导入 Java 2022-01-01
- 在java中使用xpath和selenium解析HTML表格数据 2022-01-01
- 如何在相机中应用自定义滤镜 [Surfaceview 预览]. 2022-01-01
- Maven:无效的目标版本:10 2022-01-01
- JPA惰性列表上的流 2022-01-01
- 将 double 转换为 Int,向下舍入 2022-01-01
- doFilter()是在servlet的工作完成之前还是之后执行的? 2022-01-01
- 控制台应用程序中的 Java 键盘输入解析 2022-01-01
- Java ECDSAwithSHA256 签名长度不一致 2022-01-01
- 在springboot中如何给mybatis加拦截器 2023-04-29
