Problem with System.getProperty()

M

manasd

Hi,
I have a Java program on a Windows XP machine configured with the
following settings
Regional Option: Chinese PRC
Language: Chinese PRC.

My Java program uses the following call: countryCode =
System.getProperty("user.region"); However the value of countryCode is
null instead of "CN". I am using JDK/JRE 1.4.2. Is this is a bug or is
there anything wrong with my setup?

Thanks in advance.

Regards,
-Manas
 
C

Chris Smith

Hi,
I have a Java program on a Windows XP machine configured with the
following settings
Regional Option: Chinese PRC
Language: Chinese PRC.

My Java program uses the following call: countryCode =
System.getProperty("user.region"); However the value of countryCode is
null instead of "CN". I am using JDK/JRE 1.4.2. Is this is a bug or is
there anything wrong with my setup?

Where are you getting that property name? I see a lot of Google results
from people who both expect and see it set, but it's not specified in
the API specification. If indeed it is set, this would be unspecified
behavior.

Try java.util.Locale.getDefault() instead.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
D

ddk

import java.util.*;
Locale local = Locale.getDefault( );
System.out.println( l.getCountry( ) );
 
I

IchBin

ddk said:
import java.util.*;
Locale local = Locale.getDefault( );
System.out.println( l.getCountry( ) );
I think you meant this...
System.out.println( local.getCountry( ) );

--


Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top