Java 在 Windows XP 中为 Tomcat 服务设置默认语言环境
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1153521/
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 default locale for Tomcat Service in Windows XP
提问by kazanaki
I have installed Apache Tomcat 6 as a Service in a Windows XP computer (French)
我已经在 Windows XP 计算机中安装了 Apache Tomcat 6 as a Service(法语)
My problem is that Tomcat itself and all webapps (Sonar and Hudson) now show french messages. I want English messages of course so I went to the "Regional Settings" window in Control panel and changed everything to English (US)
我的问题是 Tomcat 本身和所有网络应用程序(Sonar 和 Hudson)现在都显示法语消息。我当然想要英文信息,所以我转到控制面板中的“区域设置”窗口并将所有内容更改为英文(美国)
Tomcat however is stillin French. Nothing changed at all.
然而Tomcat仍然是法语。什么都没有改变。
I suspect that because it runs as a service it does not pick the settings from control panel.
我怀疑因为它作为服务运行,所以它不会从控制面板中选择设置。
So is there any way to trick the Tomcat JVM so that it uses English instead of French? I have sys admin access to the machine (XP PRO French)
那么有没有办法欺骗Tomcat JVM,使其使用英语而不是法语?我有对机器的系统管理员访问权限(XP PRO 法语)
Thank you
谢谢
采纳答案by Brian Agnew
You need to set user.language
and user.region
appropriately,
您需要设置user.language
和user.region
适当的,
e.g.
例如
java -Duser.language=en -Duser.region=CA
in your Tomcat startup (probably catalina.bat
). Check this linkfor more info, and for references to the sets of valid ISO codes for the above.
在您的 Tomcat 启动(可能catalina.bat
)中。查看此链接以获取更多信息,以及对上述有效 ISO 代码集的参考。
回答by Rudy
Specify language option in service parameters.
在服务参数中指定语言选项。
$Tomcat/bin/javaw.exe move to Java tab and specify -Duser.language=en -Duser.region=CA at Java Options:
$Tomcat/bin/javaw.exe 移至 Java 选项卡并在 Java 选项中指定 -Duser.language=en -Duser.region=CA:
回答by David Bala?ic
Regional Settings are per user and services are run as a different user (which one is used for each service can be checked in Control Panel / Administrative Tools / Services ).
区域设置是针对每个用户的,服务以不同的用户身份运行(可以在控制面板/管理工具/服务中检查每个服务使用哪个)。
So you changed the settings for the user account you used to log in, while the Tomcat service is run under a different account.
因此,您更改了用于登录的用户帐户的设置,而 Tomcat 服务在不同的帐户下运行。
回答by jdussault
The Tomcat manager was showing up in French for me, despite the fact that I tried some of the suggestions above. The issue turned out to be browser specific. Chrome had "French" listed as one of my languages and as soon as I removed it from the list in preferences and refreshed the page, Tomcat showed up in English. I hope that will be helpful for anybody else in the future who is having this sort of problem.
尽管我尝试了上面的一些建议,但 Tomcat 经理还是用法语出现在我面前。结果证明该问题是特定于浏览器的。Chrome 将“法语”列为我的语言之一,一旦我将其从首选项列表中删除并刷新页面,Tomcat 就会以英语显示。我希望这对将来遇到此类问题的其他人有所帮助。
回答by Jorge Constanzo
Unfortunately, catalina.bat (or catalina.sh) is not executed by Windows when running Tomcat service, so catalina.bat modification doesn't solve this problem.
遗憾的是,catalina.bat(或catalina.sh)在运行Tomcat服务时并没有被Windows执行,所以修改catalina.bat并不能解决这个问题。
The solution is to run the service manually (or re-install the service) adding these parameters to the execution of the service. Here it's the specification of how the service must be run or installed in order to do this:
解决方案是手动运行服务(或重新安装服务)将这些参数添加到服务的执行中。这是服务必须如何运行或安装才能执行此操作的规范:
https://tomcat.apache.org/tomcat-6.0-doc/windows-service-howto.html(Tomcat 6) https://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html(Tomcat 7)
https://tomcat.apache.org/tomcat-6.0-doc/windows-service-howto.html(Tomcat 6) https://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html(雄猫 7)
According to this specification, to run Tomcat6 service establishing en_US locale, you should execute:
根据这个规范,要运行建立 en_US locale 的 Tomcat6 服务,你应该执行:
> $PATH_TO_TOMCAT/bin/tomcat6.exe //TS//Tomcat6 ++JvmOptions -Duser.language=en;-Duser.region=US
In the link above, there are some examples of how to install and delete the service as well.
在上面的链接中,还有一些关于如何安装和删除服务的示例。
Hope this helps!
希望这可以帮助!