Java Internationalization and .properties files
Hi everyone,
Isn't it problematic that the way to internationalize your java apps ( .properties files ) doesn't support UTF-8 and you have to user gibberish looking unicode escapes. Some will say that you don't need to write and the converters or editors will handle the ascii conversion but the requirement for such a intermediate process doesn't seem right. Sometime you have to edit some string on the server and it should be human readable using text editors that support UTF-8. I thought loadFromXML and storeToXML methods that came with java 1.5 seemed to solve the problem but than noticed that PropertyResourceBundle doesn't support xml properties files. Is backwards compatibility the reason that properties files aren't utf-8 by default?
Thanks
Bilgehan
Try PRBeditor (http://prbeditor.dev.java.net).
Similar Messages
-
Revision: 2200
Author: [email protected]
Date: 2008-06-24 07:46:04 -0700 (Tue, 24 Jun 2008)
Log Message:
The main package will now also include the ja swc's and properties files.
-it will not include the samples, these will still be in the ja zip
bug:http://bugs.adobe.com/jira/browse/SDK-15852
Ticket Links:
http://bugs.adobe.com/jira/browse/SDK-15852
Modified Paths:
flex/sdk/branches/3.0.x/build.xmlHi,
First up thanks for helping out, I really appreciate it.
Is there a way to change that or should I simply add the file to the Classpath?
The config file at present sits in c:\Temp\ESFGFL\servicelayer\config\maysqlconfig.properties with the code in the servicelayer directory.
My classpath is set as .;C:\Program Files\Java\jre6\lib\ext\QTJava.zip;C:\Program Files\Java\jre6\lib\javamail-1.4.2\mail.jar
What do I need to change here? Ultimately te code will be on a servera nd so will the config file but learning some lessons by testing locally is proving invaluable.
Thanks again for your help
nathj -
Hi all,
I have a jar file packaged as com.company.java located in $JAVA_HOME/jre/lib/ext. It will read a properties file when it is initialized. As I know, properties file needed to put under $CLASS_PATH. So I put it under $JAVA_HOME/jre/lib/ext also. However, the JAR file failed to load the properties file.
Below is a part that in JAR file for getting properties file.
ResourceBundle rb = ResourceBundle.getBundle("abc",Locale.getDefault());
s=rb.getString("key1");
} catch (MissingResourceException e) {
s=null;
e.printStackTrace();
Do I put the properties file in wrong location?
Where do I put it to make it work?
Rgds,
unplugby default you have 3 class loaders that load classes as well as read resources:
The bootstrap classloader (for the core classes)
The extension class loader (finds anything in any .JAR placed in $JAVA_HOME/jre/lib/ext/ [which is the home directory for "extension modules"])
And the system class loader (looks along the classpath, finds files inside JARs [listed in the classpath] and in normal subdirectory structures [of base directories listed in the classpath] that mirror the hierarchy of Java packages)
Any of these is supposed to consult the previous loader on the above list first, and try a lookup on its own only if the previous loaders did not find a class.
ResourceBundle.getBundle(String, Locale) uses the classloader of its caller to look for the properties. If your method calling getBundle() was called from another method inside your extension module it will first consult the extension classloader (which first consults the bootstrap classloader) and will not be able to use the system classloader. So you can place anything in the classpath but it won't help. And the extension class loader can only look into JARs, not plain package directories.
If the getBundle() method were called directly from the application code, however, it will use the system class loader to locate the properties file.
There is a method ResourceBundle.getBundle(String, Locale, ClassLoader) where you can pass in e.g. the system class loader if you know how to get it, so this might help. The application code would determine its own class loader and pass it to the method of your your extension module.
But I am not sure that you should place the properties file in $JAVA_HOME/jre/lib/ext/ since this is intended for Java extensions rather than normal user code, it normally does not show up on the classpath. Also, if you place it along the classpath, you have to pass in the classloader to be used since your code was loaded by the extension classloader and has no immediate knowledge of the system classloader.
But perhaps it would be wiser to load your resource bundle reader in the system classloader, like any other application code: Remember that classes loaded by the extension classloader have higher security privileges than normal application code (the security policy file that you can edit refers to application code!) and it is questionable whether a resource bundle reader needs that privileges. If it does not, you might just place it in the classpath rather than the extension directory. Then it is quite natural that a properties file will also be found on the classpath. -
Timestamp in Java log and trace files.
Hi SAP'ies
Running PI 7.11 on AIX 6.3 we face an issue with the content of log and trace files from Java.
Eg.
The file DefaultTrace_00.0.trc is timestamped 18-05-10 11:16:15. (The same time as the time of the OS/AIX)
Looking inside the file the last statement is timestamped 2010 05 18 09:16:15.
How can we ensure that the content of these Java files are timestamped with OS time?
Looking into ABAP files like dev_w0 the timestamp of the file and the content are equal.
Best regards,
Teddy Løv AndersenHello All
Best way to convert the default trace time is , visit the site
http://www.csgnetwork.com/epochtime.html
here enter , for example if you have the following in default trace
#1.#00265510DE7300120000000F000022030004C77AD7309DF5#1345230317066#com.sap.portal.fpn.rdl
1345230317066 is time stamp , enter this in the above site to get the time
Fri Aug 17 2012 21:05:17 GMT+0200
Regards -
okay, this may be really naive and maybe i'm missing some key piece of
documentation, but i'm missing something regarding the file structure with
iplanet enterprise 4.1 on solaris.
in my /usr/local/netscape/suitespot there's a docs directory that is the
default docs directory.
I've created a /WEB-INF directory under docs and a /classes directory under
that. I've placed a jay.properties file in the /WEB-INF/classes directory,
but when I try to access that through a servlet instantiated bean, I get an
error from the ResourceBundle call, telling me that it can't load that
properties file.
I have two questions:
1. did i build the WEB-INF directory in the correct place (ie - is this the
standard way of working under the iplanet server) - this doesn't seem to be
supported by the admin server in the sense that i can browse this directory,
when i'd expect that iplanet would build in some basic security around the
WEB-INF directory
2. what do i name and where do i put the properties file? should it be
jay_en.properties? i've tried a number of different scenarios with no luck.
thanks...
jayWhy would you create a WEB-INF directory on the web tier?
WEB-INF is a directory with a special meaning to the web container. All
of your properties files and such will need to be placed on the
application server tier, in the WEB-INF directory that was automatically
created there. And you can do that just be properly placing them in the
WAR file.
David
Jay Wright wrote:
> okay, this may be really naive and maybe i'm missing some key piece
> of documentation, but i'm missing something regarding the file
> structure with iplanet enterprise 4.1 on solaris.
>
> in my /usr/local/netscape/suitespot there's a docs directory that is
> the default docs directory.
>
> I've created a /WEB-INF directory under docs and a /classes
> directory under that. I've placed a jay.properties file in the
> /WEB-INF/classes directory, but when I try to access that through a
> servlet instantiated bean, I get an error from the ResourceBundle
> call, telling me that it can't load that properties file.
>
> I have two questions: 1. did i build the WEB-INF directory in the
> correct place (ie - is this the standard way of working under the
> iplanet server) - this doesn't seem to be supported by the admin
> server in the sense that i can browse this directory, when i'd
> expect that iplanet would build in some basic security around the WEB-INF
> directory
>
> 2. what do i name and where do i put the properties file? should it
> be jay_en.properties? i've tried a number of different scenarios
> with no luck.
>
> thanks... jay
>
>
> -
Hello,
There is a way to distribute the Mysql db files with yout java application without need to install Mysql in the computer, like in access, you just copy the .mdb file with your java class and create a conection to it.
Thank YouNo. If you want to do that you should just use Access. mySQL files will not work without the mySQL server.
-
Hello,
I am wondering if an application (java classes for instance) can read a .properties file inside the ear package, when the application is deployed ?
(only reading of course)
Thank youI'd recommend using ClassLoader.getResourceAsStream to access the properties file.
This means the file needs to be in the resource path of your classloader. In WLS, an easy way to do this is to have it in the APP-INF/classes directory of your EAR file.
-- Rob
WLS Blog http://dev2dev.bea.com/blog/rwoollen/ -
Hi,
Does anyone experience similar problem. I am using NT Realm using a user already define in my NT domain. The properties File for WLS required that password be present for the system user.
Having this when I start weblogic, I can log onto WLS with password define for the system user in NT domain as well as the funny password I put in the properties file just to fill the requirement.
I thought that the password define in NT domain should prevail over the one define in the properties file. Is there any solution around this? Any help will be greatly appreciate?
Thanks.
Amen Akakpohi,
use PreferredMaxBytes=0 in the config.xml something like.
<NTRealm Name="MyNTRealm" PreferredMaxBytes="0"
PrimaryDomain="xyz.com"/>
thanks
kiran
"Marco Righetti" <[email protected]> wrote in message
news:3cc745f8$[email protected]..
>
I´m facing a problem with JVM when configured my NT Security Realm in WLS6.1 SP2.
NT server 4 SP6a. When WLS started, I got message reporting ACCESSVIOLATION at module
NTAPI32.DLL (outside JVM) in Function: LocalGroupEnum. After teh WLS isterminated.
The user that start WLS has rights in Domain as part of system and tokensand he
is member of Administrators (both Local and Domain groups)
Does anyone know what is happening ?
Regards
Marco -
I18n:bundle and properties files
Hi,
I'm currently developing a multi-language web site with some users having local administration roles for their own country.
I need to provide online resource translation feature. So I made pages for editing properties files.
The problem is that the files are correctly updated but the pages still show old values unless webapp is restarted.
I tried to clear the cache of the ResourceBundle class (by getting the cacheList class field) but it didn't change anything to the problem.
Any help on this ?
Thanks in advance.Sorry, I forgot about my post in this forum...
I solved this problem by developping an alternative implementation of the ResourceBundle class meeting my needs, and corresponding taglib upon it to use in my pages.
This works fine. -
Java script and css files are not loaded
I am using 9iAS 1.0.2.2.2a on Windows Server Family 2000. My web application is using bc4j and developed in JDeveloper 3.2. I am also using Apache and web cache and caching js and css files.
Problem is some times it does not load js files but load css files.
Some times loads css files but does not load js files.
Some times does not load js and css files.
& some times loads both types of files.
How to control this problem.
Tahir Pervaiz.I'm fairly certain this issue represents a bug in IE 11. The same problem(s) do not occur in IE 9 or IE 10. The same problems occur on unrelated websites accessed from separate machines. Doing a force-refresh (Ctrl+F5) always fixes the issue.
I took your advice about opening the console to look for error messages during page load. When loading normally (i.e. not doing a force-refresh), the console shows the following:
HTML1300: Navigation occurred.
File: TimeEntry
DOM7011: The code on this page disabled back and forward caching. For more information, see: http://go.microsoft.com/fwlink/?LinkID=291337
File: Dashboard
SCRIPT70: Permission denied
File: modernizr-2.5.3.js, Line: 468, Column: 9
SCRIPT70: Permission denied
File: jquery-ui-1.10.0.js, Line: 252, Column: 1
SCRIPT70: Permission denied
File: knockout-2.2.1.js, Line: 48, Column: 5
SCRIPT5007: Unable to get property 'extend' of undefined or null reference
File: knockout.validation.js, Line: 30, Column: 5
When loading the page via a force-refresh, only the 'Navigation occurred.' message is displayed. It does not make sense that IE would apply a more restrictive security policy to scripts loaded from cache vs. scripts loaded directly from their original location,
yet that appears to be what is happening.
Post questions about html, css and scripting for website development to the IE Web Development forum.....WITH A LINK TO YOUR WEBSITE OR A MASHUP THAT SHOWS THE ISSUE...
looks like you have a sandboxed iframe on your page.
the first step in troubleshooting IE issues is to test in noAddons mode.
Rob^_^ -
Using jrun and properties files
For some reason my while deploying, the jsp cannot find the .properties file. I've tried putting it in almost every single directory on the server. Can anyone help???
ThanksThe .properties files must be in the classpath that JRun is using. There should be a <something>\classes directory in your CLASSPATH that JRun's using, try putting it in there.
Take Care,
Rob
null -
Java proxy and EAR file in NDS
Hi,
I'm new in java and also proxy development and I need some help
I have followed the pdf how to create java proxies in 3.0.
But i have some doubts:
Must I delete aii*.jar libraries from the EAR create?
I have no other .jar archive in that .ear... why? I suppose that is not correct and why my EJB module .jar is not included?
Thanks
carme,Hi, Shabarish
I have followed the same steps point out in this two blogs.
I recreated all my EJB project and application.
The EAR file created only contains:
guidgenerator.jar
aii_utilxi_misc.jar
aii_proxy_xirt.jar
aii_msg_runtime.jar
sda-dd.xml
application-j2ee-engine.xml
application.xml
Sap_manifest.mf
Manifest.mf
and also a file WITHOUT NAME and size 0.
That is not correct... right? -
Hi everyone,
I build a class in java, and now i wanna use this class in my jsp file.
I put that class into web-inf/classes in Apache Tomcat, but don't work.... Anyone can help me?
Greetings!Put the class with its package such as com.sun.ejb.MyClass
-- > /WEB-INF/classes/com/sun/ejb/MyClass.class
then use it
http://www.skillipedia.com -
Java executables and jar files
I'm new to Java and recently completed a Java training class that involved the creation of a cutomer service application in Microsoft Visual J++. The application ran fine in debug mode. However, no mention was made of how this would be run on a machine without an development tool as J++. How is this done? Can Java programs be compiled into .exe's like C, C++,, abd Visual basic programs? If not, how are the classes called to make use of their code?
Also, what is a .jar file and how is it used?You went to a class and they didn't teach you the answers to these questions? I say go and get your money back: you we're ripped off.
1) Yes you can turn your java code into an .exe but that would be pointless as java was designed to be "platform independant" and this violates that principle.
2) jar files are zip files for all intents and purposes. They contain your 'compiled' java byte code.
3) Microsoft does not support J++ nor does it ship java with its browser anymore so I suggest you download java from this website and use the real thing. -
We are have started using a PAC files to control how our Browsers connect to the Internet.
What we have found out is Java won't use the PAC files when version Java version.
Java installs just fine but fails on the "Verify Java Version".
Here is the message you get: "We are unable to verify if Java is currently installed and enabled in your browser".
If I un-check "Use automatic configuration script and check proxy server and point to the same web proxy IP used by the PAC file. Java verifies.
We found this issue when web applications started failing to open their java applets because it couldn't version the Java version.
How do I get Java to use our PAC files?No. If you want to do that you should just use Access. mySQL files will not work without the mySQL server.
Maybe you are looking for
-
Transferred from iPhone 3GS to 4. Backed up and restored smoothly. Still getting a "no service" message in the upper left corner of new phone. Help?.....
-
I can't change copy paper size in HP M125a
Hi all, I bought a HP M125a printer (Print, Copy, Scan) but I have a problem with copying A4 Pages. When I put my A4 paper in scanner to copy it, The laser of my printer just scan from beginning to LTR (Letter) position results 2CM in bottom of my ma
-
After using iWeb 09 since it was released, I now get this error when opening the app. Can't open file "/Applications/iWeb.app/Contents/Resources/Themes/Cloud 9.webtheme/Spanish.lproj/Podcast.webtemplate." I have tried opening from and external back u
-
Lumia Black Update for Lumia 620
It has been February waiting for update In India, i guess only 620 is only phone that has not got this update. :'( By what time can we expect the update :\ Nokia support site also is struck on same since jan 31. No change Thanx
-
Multiple instances of AcroRd32.exe while using Windows Explorer Preview Pane
I'm trying to understand why our computers behave differently while browsing PDF files using Windows Explorer with the preview pane turned on. All are Windows 7 Pro 32-bit. The scenario: Open Windows Explorer with the preview pane turned on, go to a