JRockit 1.4.2 / JRockit 1.4.1 - different results compared to SUN - LANG environment variable - CR223211 (Doc ID 776476.1)

Last updated on NOVEMBER 05, 2016

Applies to:

Oracle JRockit / JRockit / 1.4.2,1.4.1
Information in this document applies to any platform

Goal

DESCRIPTION:
The following C program is used to start a JVM:

test.c:
#include<sys/types.h>
#include<sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <jni.h>

/* the current (sole) jVM */
static JavaVM *jVM = NULL;
int
main (int argc, char **argv)
{
int ret, i;
JNIEnv *jEnv = NULL;
JavaVMInitArgs jVMArgs;
JavaVMOption *jVMOptions;
const char *teststring = "3.141";
double testvalue, testvalue2;
testvalue = atof (teststring);
jVMOptions = calloc (argc, sizeof (JavaVMOption));
jVMArgs.version = JNI_VERSION_1_2;
for (i = 1; i < argc; i++)
{
jVMOptions[i].optionString = argv[i];
}
jVMArgs.options = jVMOptions;
jVMArgs.nOptions = argc - 1;
jVMArgs.ignoreUnrecognized = JNI_TRUE;
printf ("Creating JVM.\n");
/* Create the Java VM */
ret = JNI_CreateJavaVM (&jVM, (void **) &jEnv, (void *) &jVMArgs);
printf ("JVM-Init returns %d.\n", ret);
printf ("Testvalue conversion of \"%s\"\n", teststring);
fflush (stdout);
testvalue2 = atof (teststring);
printf ("init %f after init %f.\n", testvalue, testvalue2);
return 0;
}

The result of testvalue of JRockit and SUN JVM are different:

JRockit (init 3,141000 after init 3,000000) and 
SUN (init 3.141000 after init 3.141000)

 j2sdk1.4.2_01 (SUN)

 linux jrockit1.4.2_05 (BEA)

This is caused by the enviroment setting of LANG=de_DE@euro 
 
This seems to be used by JRockit, but not by SUN's JVM.

The C program uses the standard Posix environment with no LANG setting and so does SUN.

CONFIGURATION:
IA32 SuSE Linux
JRockit 1.4.1 or JRockit1.4.2_05

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms