JVM and Operating System configuration

JVM and Operating System (Checks #1, #2)

Some of the string values and date formats that appear in client’s browser are taken by Bedework from the locale management of the operating system on the server. The JVM on which Bedework runs takes some of the string values and date formats from the underlying OS using java locale, date and time classes. So it is quite important that both, JVM and OS, are configured correctly.

Operating System checks


To check the current locale configuration of the OS you can use the command “locale” in Unix boxes or checking the language options of Control Panel in Windows machines

In Unix the locale command returns something like this:

$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=


In this case “en_US" (English – United States) is the default language configuration. To change it to "es_ES" (Spanish – Spain) use the following commands:

$ export LC_ALL=es_ES.UTF-8
$ export LANG=es_ES.UTF-8 


And now the command locale should show

$ locale
LANG=es_ES.UTF-8
LC_CTYPE="es_ES.UTF-8"
LC_NUMERIC="es_ES.UTF-8"
LC_TIME="es_ES.UTF-8"
LC_COLLATE="es_ES.UTF-8"
LC_MONETARY="es_ES.UTF-8"
LC_MESSAGES="es_ES.UTF-8"
LC_PAPER="es_ES.UTF-8"
LC_NAME="es_ES.UTF-8"
LC_ADDRESS="es_ES.UTF-8"
LC_TELEPHONE="es_ES.UTF-8"
LC_MEASUREMENT="es_ES.UTF-8"
LC_IDENTIFICATION="es_ES.UTF-8"
LC_ALL=es_ES.UTF-8


For Unix boxes: Your server may not have all possible locale configurations installed. Some Unix(es) gives you some information about it with non-priviledged commands. In Linux (Fedora, CentOS, etc) the command “set”  gives you some info.

.....
SUPPORTED=eu_ES.UTF-8:eu_ES:eu:en_US.UTF-8:en_US:en:fr_FR.UTF-8:fr_FR:fr:de_DE.UTF-8:de_DE:de:es_ES.UTF-8:es_ES:es
.....

Make sure the language you want to support is installed on your operating system

Be aware that you can configure and issue the “$export LC_ALL=<locale>” even when that locale is not really supported on your installation. Even more, after that unsupported configuration, the  “locale” command shows supposed current locale even when the OS does not really manage it if it is not installed.

 


JVM Checks


The JVM takes some environment values from the operating system by default. To check the default locale (among others) your JVM is using you can use this class:

(See http://www.dickbaldwin.com/java/Java052.htm):

import java.util.*;
import java.lang.*;

class Prop01{
  public static void main(String[] args){

    //Instantiate and display a Properties object
    // containing the system properties

   Properties obj = new Properties(System.getProperties() );
   obj.list(System.out);

  }//end main()

}


Running this class in command line, “ java Prop01 ”, returns a list like this:

java.runtime.name=Java(TM) 2 Runtime Environment, Stand...
sun.boot.library.path=/apps/jdk/jdk142_04/jre/lib/sparc
java.vm.version=1.4.2_04-b05
java.vm.vendor=Sun Microsystems Inc.
java.vendor.url=http://java.sun.com/
path.separator=:
java.vm.name=Java HotSpot(TM) Client VM
file.encoding.pkg=sun.io
user.country=ES
sun.os.patch.level=unknown
java.vm.specification.name=Java Virtual Machine Specification
user.dir=/export/home/unavarra
java.runtime.version=1.4.2_04-b05
java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment
java.endorsed.dirs=/apps/jdk/jdk142_04/jre/lib/endorsed
os.arch=sparc
java.io.tmpdir=/var/tmp/
line.separator=

java.vm.specification.vendor=Sun Microsystems Inc.
os.name=SunOS
sun.java2d.fontpath=
java.library.path=/apps/jdk/jdk142_04/jre/lib/sparc/cli...
java.specification.name=Java Platform API Specification
java.class.version=48.0
java.util.prefs.PreferencesFactory=java.util.prefs.FileSystemPreferences...
os.version=5.8
user.home=/export/home/unavarra
user.timezone=
java.awt.printerjob=sun.print.PSPrinterJob
file.encoding=ISO8859-15
java.specification.version=1.4
user.name=unavarra
java.class.path=.:/apps/jdk/jdk142_04/lib/tools.jar:/...
java.vm.specification.version=1.0
sun.arch.data.model=32
java.home=/apps/jdk/jdk142_04/jre
java.specification.vendor=Sun Microsystems Inc.
user.language=es
java.vm.info=mixed mode
java.version=1.4.2_04
java.ext.dirs=/apps/jdk/jdk142_04/jre/lib/ext
sun.boot.class.path=/apps/jdk/jdk142_04/jre/lib/rt.jar:/a...
java.vendor=Sun Microsystems Inc.
file.separator=/
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport...
sun.cpu.endian=big
sun.io.unicode.encoding=UnicodeBig
sun.cpu.isalist=sparcv9+vis2 sparcv9+vis sparcv9 spar...


From this list, the relevant values in our case are:

user.country=ES
user.timezone=
user.language=es


Notice that the value “user.timezone=” is empty. To run the JVM with the correct ones, the Java command line options can be used, as:

$java -Duser.timezone=Europe/Madrid -Duser.country=ES -Duser.language=es Prop01

java.runtime.name=Java(TM) 2 Runtime Environment, Stand...
sun.boot.library.path=/apps/jdk/jdk150_02/jre/lib/i386
java.vm.version=1.5.0_02-b09
.....
user.country=ES
user.timezone=Europe/Madrid
user.language=es
.....


You should change those environment variables before starting your Bedework installation like this:

(Unix)

JAVA_OPTS="$JAVA_OPTS -Duser.timezone=Europe/Madrid  -Duser.country=ES -Duser.language=es -Dfile.encoding=UTF-8 -Duser.variant=ES"
(windows)

SET JAVA_OPTS=%JAVA_OPTS%  -Duser.timezone=Europe/Madrid  -Duser.country=ES -Duser.language=es -Dfile.encoding=UTF-8 -Duser.variant=ES 


The  startjboss  or  startjboss.bat  inherits the values of JAVA_OPTS and adds them to the ones it sets itself.  

Bedework Enterprise Calendar Server, version 3.10