0

Could you guide me on how to set "Java File Encoding" and "Java Default Locale" in Linux CentOS server ? I would like to set the following.

Java File Encoding Cp1253
Java Default Locale el_GR

I had tried setting in bashrc, but its not working. Please advise.

I have full access to my Linux machine and installed Java via yum.

2
  • Do you want to change it only to JVM or to the whole system? Feb 23, 2016 at 15:24
  • @marcospereira .. Thank you! I want to change only for the JVM..
    – snowman
    Feb 23, 2016 at 15:47

2 Answers 2

1

I was able to see that coldfusion fetch the values from some other location and not from console or enviornment vairables which we set. I had added the following to "jvm.config" file of coldfusion and restarted it. Now everything looks great as expected.

-Dfile.encoding=CP1253 -Duser.language=el -Duser.country=GR

1

You have to pass it to JVM via command line arguments:

java -Dfile.encoding=CP1253 -Duser.language=el -Duser.country=GR YourClass

You can also add these to JAVA_TOOL_OPTIONS which gets picked up by the JVM durring startup:

Linux:

export JAVA_TOOL_OPTIONS="-Dfile.encoding=CP1253 -Duser.language=el -Duser.country=GR"

Windows:

set JAVA_TOOL_OPTIONS="..."

after which you can simply call

java YourClass
3
  • Thanks a lot. The command for CentOS just works fine. Im using coldfusion on server, but its not taking the values which I mentioned. Refer the following output. JVM Details Java Version 1.6.0_04 Java Vendor Sun Microsystems Inc. Java Vendor URL http://java.sun.com/ Java Home /opt/jrun4/jre Java File Encoding UTF8 Java Default Locale en_US .. Any idea?
    – snowman
    Feb 23, 2016 at 15:38
  • thanks for your inputs and I just need to enter it in the right location of my application.
    – snowman
    Feb 23, 2016 at 16:27
  • at risk of sounding cheeky, but if the answer contributed to your solution and answers the question where you didn't specify the fact that you are running in a servlet container, an UP vote would be nice. Thanks!
    – diginoise
    Feb 28, 2016 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.