Environment variable (NLS_LANG) value altered in Java process?
Posted
by Ralkie
on Stack Overflow
See other posts from Stack Overflow
or by Ralkie
Published on 2010-03-16T16:21:56Z
Indexed on
2010/03/16
22:31 UTC
Read the original article
Hit count: 254
This was noticed in some legacy Java application (jre1.4 on HP-UX).
Parent process (shell script S1) is starting Java process, which on its own is starting child process (shell script S2). Schematically it's: S1 > Java > S2.
NB! Java application connects to Oracle DB using OCI driver.
What is strange here is that process running S1 has environment variable NLS_LANG
set to american_america.BLT8MSWIN1257
, Java spawns S2 using:
Runtime.getRuntime().exec(cmd);
and S2 shows that NLS_LANG
is set to american_america.UTF8
(!)
This happens on some limited-access environment (production), I was not able to reproduce same problem on linux with jre 1.5.
AFAIK, Java process should inherit environment from its parrent (S1) and should pass all environment variables to its child S2 (since single argument exec
call was used). However, it does not seem to be the case. Any ideas why NLS_LANG
appears to be altered?
© Stack Overflow or respective owner