Setting default locale for Tomcat Service in Windows XP - java

I have installed Apache Tomcat 6 as a Service in a Windows XP computer (French)
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 however is still in French. Nothing changed at all.
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)
Thank you

You need to set user.language and user.region appropriately,
e.g.
java -Duser.language=en -Duser.region=CA
in your Tomcat startup (probably catalina.bat). Check this link for more info, and for references to the sets of valid ISO codes for the above.

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.

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:

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.

Unfortunately, catalina.bat (or catalina.sh) is not executed by Windows when running Tomcat service, so catalina.bat modification doesn't solve this problem.
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)
According to this specification, to run Tomcat6 service establishing en_US locale, you should execute:
> $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!

Related

Registering a java application as the default browser in Windows 10

I am writing a java application, which can handle standard links (http/https).
How can I register my application as the default program opening these links (aka default browser) in Windows 10?
I know I can select the default browser in the windows settings, but it only shows a limited list, no way to hook up a custom program.
I've found this, but it only shows how to do it pre-win10, plus I'm not sure it can be done in java.
The application needs to be packaged as an exe.
I used launch4j for this. Make sure textVersion and icon is set.
A lot of registry keys need to be created. I've pieced those together by looking at this post (kindly linked by #Tarun Lalwani), this post, and the registry entries created by firefox. This means some of them might not be necessary.
Register client
[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\MyApp\Capabilities]
'ApplicationDescription'='MyApp'
'ApplicationIcon'='C:\MyApp\MyApp.exe,0'
'ApplicationName'='MyApp'
[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\MyApp\Capabilities\URLAssociations]
'http'='MyAppURL'
'https'='MyAppURL'
[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\MyApp\DefaultIcon]
#='C:\MyApp\MyApp.exe,0'
[HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\MyApp\shell\open\command]
#='C:\MyApp\MyApp.exe'
Register url handler
[HKEY_LOCAL_MACHINE\Software\Classes\MyAppURL]
#='MyApp Document'
'EditFlags'=0x2
'FriendlyTypeName'='MyApp Document'
'URL Protocol'=''
[HKEY_LOCAL_MACHINE\Software\Classes\MyAppURL\DefaultIcon]
#='C:\MyApp\MyApp.exe,0'
[HKEY_LOCAL_MACHINE\Software\Classes\MyAppURL\shell]
#='open'
[HKEY_LOCAL_MACHINE\Software\Classes\MyAppURL\shell\open\command]
#='"C:\MyApp\MyApp.exe" --url "%1"'
Register to default programs
[HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications]
'MyApp'='Software\Clients\StartMenuInternet\MyApp\Capabilities'
Now the application can be selected in the windows settings

install4j auto update download failure

I'm trying to use the auto-update feature of install4j. The updater is configured as stand-alone and is launched by the user from a menu item with the code snippet from the installer configuration. The updates.xml URL is configured in the Auto-Update Options screen.
The updater is started correctly but then it fails with the error "The update information could not be downloaded from ". The URL is correct and the xml file can be viewed from a web browser on the same client computer. I tried disabling the firewall and antivirus, but nothing has changed.
I use install4j version 6.1.6 and the target platform is Windows (tested on Win7 and WinXP just in case).
Can anyone suggest a possible reason for this failure and/or a way to get more diagnostic information?
Thanks in advance
Sasha
I solved the problem by disabling browser integrity check in the CloudFlare settings. This means that install4j is sending malformed HTTP headers that are interpreted by the CloudFlare firewall as suspicious.
I do hope that this install4j bug will be fixed, since allowing access at the CloudFlare level means that the server is more exposed to actual threats.

Java Security Exception list does not work

I have a problem with adding sites to the java security exception list.
According to the documentation (http://java.com/en/download/faq/exception_sitelist.xml) the exception list does exactly what I want.
Stop this stupid security message and let me use the application which I KNOW is secure.
Following setup:
Ubuntu Development machine, running application server with a little java applet on the login page (Do not ask why, I don't know thats how the application works).
If I use my local browser everything works fine.
But I have to test the site with Windows in an virtual box VM.
I have an IE8/Win7 image from modern.ie running.
I installed the latest java on this VM and every time I try to login the Java applet is blocked because of my security settings (yeah.. "my").
I added the hostname of my machine to the exception list in the java control panel (in the vm of course).
But this does not change anything it.
The application runs at http://myhost:1234/APPLICATION-NAME
I've added every possible combination to the exception list like:
http://myhost
http://myhost:1234 (with and without trailing /)
http://myhost:1234/APPLICATION-Name (with and without trailing /).
nothing worked.
Does anyone know if this exception list thing still works as stated on the FAQ page from oracle?
Why is there not a button named "oracle I know what I'm doing".

Running Local Java Application with File System & Port restrictions

I need to run a java application (not an applet or JNLP, but a full blown application in the JRE) and need some restrictions on:
File System - The app could only access 1 folder to read & write (this would be a fixed path for the app's reference like / )
Ports - The app could only access several local ports. (eg could only access port 8080 / 3306 only)
Is there a way to do this? I have searched through Java Security & Policies but came nothing close to a solution.
I am considering to write a container to run this app or changing / overriding the classes (in case of OpenJDK). Is this ok?
This is for an open source project that we are about to start, Appreciate some good advice from the wise StackExchange community.
regards
First and most basic, run the java application with a user who has the minimum permissions required for the app to do its work.
Secondly, set the java SecurityManager and configure it.
SJuan76 has the right answer here. The SecurityManager is the appropriate way to restrict files/directories a java app can access. This tutorial might be a good guide to setting that up.
You can restrict the ports your java app listens on. But restricting ports really requires an OS level firewall to be configured.

How we can open browser through j2me code in ubuntu os?

How we can open browser through Java ME code in ubuntu os ?
I am using the below given code
String URL1="any url";
midlet.platformRequest(URL1);
The above line does not open the browser in the UBUNTU 10.10 but its working fine on windows os.
Please help me if any body else have faced the same problem.
if you use emulator (which one?), check if it is properly configured (emulators tend to have stuff like that in User Guide y'know)
eg this article provides a recipe for WTK / ME SDK:
...The J2ME Wireless Toolkit supports the platformRequest() method, but
before using the method you must tell the toolkit what to do when it's
invoked. You can associate only one platform service with
platformRequest(). For instance, if for testing purposes you associate
the method with your browser, the browser will be launched every time
you call platformRequest(). If you need more flexibility, you can
associate platformRequest() with a script that will use the URL
scheme to route the request to the right handler.
To associate a particular platform service with platformRequest(),
simply add a com.sun.midp.midlet.platformRequestCommand attribute to
the system.config file in the toolkit's lib directory. For example, to
invoke the Mozilla browser whenever platformRequest() is called, add
the following to system.config:
# Associate the Mozilla browser with platformRequest() - Windows
com.sun.midp.midlet.platformRequestCommand: "C:\Program Files\mozilla.org\Mozilla\mozilla.exe"
Given this setting, the call
platformRequest("http://developers.sun.com/mobility") will launch
Mozilla, and the browser will navigate to Sun's developer mobility
portal...

Categories