在 Windows 上全局设置“JAVA_OPTS”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9842134/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Setting "JAVA_OPTS" globally on Windows
提问by RYN
I need to set -Dfile.encoding=UTF8 globally on Windows machine.
I tried to set JAVA_OPTS environment variable in My Computer -> Properties ->Environment Variables
and also via Control Panel->Java->Java Runtime Environment Settings
but these had no effect.
How can I set JAVA_OPTS (and specially file.encoding
property) globally in windows?
我需要在 Windows 机器上全局设置 -Dfile.encoding=UTF8 。
我尝试在 JAVA_OPTS 环境变量中设置 JAVA_OPTS 环境变量My Computer -> Properties ->Environment Variables
,也通过,Control Panel->Java->Java Runtime Environment Settings
但这些没有效果。
如何file.encoding
在 Windows 中全局设置 JAVA_OPTS(和特殊属性)?
Thanks
谢谢
采纳答案by ring bearer
Did you try setting up environment variable JAVA_TOOL_OPTIONS
?
您是否尝试设置环境变量JAVA_TOOL_OPTIONS
?
Set this to "-Dfile.encoding=UTF8"
and it is supposed to be picked up by jvm. But if it doesn't, you are left with no choice other than to use command line parameter.
将此设置为"-Dfile.encoding=UTF8"
它应该被jvm拾取。但如果没有,除了使用命令行参数外,您别无选择。