Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2005

Tip: Looking for answers? Try searching our database.

Problem with System.getProperty()

Thread view: 
manasd@gmail.com - 03 Dec 2005 19:44 GMT
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
Chris Smith - 03 Dec 2005 21:48 GMT
> Hi,
>    I have a Java program on a Windows XP machine configured with the
[quoted text clipped - 6 lines]
> 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.

Signature

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

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

ddk - 04 Dec 2005 07:52 GMT
import java.util.*;
Locale local = Locale.getDefault( );
System.out.println( l.getCountry( ) );
IchBin - 04 Dec 2005 08:02 GMT
> import java.util.*;
> Locale local = Locale.getDefault( );
> System.out.println( l.getCountry( ) );

I think you meant this...
System.out.println( local.getCountry( ) );

Signature

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-)

ddk - 04 Dec 2005 08:17 GMT
oh, you are right.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.