[英]JAVA_OPTS is not recognized
我有以下序列
ubuntu@ip-10-63-3-254:/mnt$ export JAVA_OPTS=-Dmt.config.from=En ubuntu@ip-10-63-3-254:/mnt$ echo $JAVA_OPTS -Dmt.config.from=En ubuntu@ip-10-63-3-254:/mnt$ javac hello.java ubuntu@ip-10-63-3-254:/mnt$ java hello mt.config.from=null ubuntu@ip-10-63-3-254:/mnt$ java -Dmt.config.from=En hello mt.config.from=En ubuntu@ip-10-63-3-254:/mnt$
其中hello.java
public class hello { public static void main (String[] args) { String property = "mt.config.from"; String value = System.getProperty(property); System.out.println(property + "=" + value); } }
为什么我的导出JAVA_OPTS = -Dmt.config.from = En没有被hello.java选中? 谢谢
我认为你需要在运行时引用$JAVA_OPTS
,例如:
java $JAVA_OPTS hello
我认为java
根本不会检查环境变量,它更像是在启动jvm时脚本中使用的约定。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.