【问题标题】:Is there any way to programmatically check, if `-noverify` is set on the JVM?如果在 JVM 上设置了“-noverify”,有没有办法以编程方式检查?
【发布时间】:2016-05-30 10:59:32
【问题描述】:

我需要使用 VM 选项 -noverify 运行一些测试。
现在我想警告此项目中的任何其他开发人员设置此选项(如果尚未设置)。

当然,另一种可能的解决方案是设置此选项,而不是仅仅发出警告。

【问题讨论】:

标签: java jvm jvm-arguments


【解决方案1】:

java.lang.System.getProperties() 方法确定当前系统属性。 getProperty(String) 方法使用的当前系统属性集作为 Properties 对象返回。

运行这个程序

public class ShowSystemProps {

   public static void main(String[] args) {

   // Get the current system properties
   Properties p = System.getProperties();
   p.list(System.out);
  }
} 

【讨论】:

  • 遗憾的是,系统属性中没有列出 vm 参数。 @Ravis 评论持有解决方案
猜你喜欢
  • 2010-10-30
  • 1970-01-01
  • 2021-08-15
  • 1970-01-01
  • 1970-01-01
  • 2011-07-18
  • 1970-01-01
  • 2021-06-16
  • 1970-01-01
相关资源
最近更新 更多