W
Wells
Hello all,
I know there is no direct way to read Solaris env variables using JDK 1.4.2
but I think I should be able to use something like what's below to get at
them indirectly. The problem is that I always get a null myvar. Can anyone
help me?
Thanks so much.
Wells...
---------------------------
Process p = Runtime.getRuntime().exec("sh -l echo $JAVA_HOME");
BufferedReader br = new BufferedReader(new
InputStreamReader(p.getInputStream()));
String myvar = br.readLine();
System.out.println(myvar);
------------------------------
PS: This works on windows if I do:
Process p = Runtime.getRuntime().exec("cmd.exe /c echo %JAVA_HOME%");
PPS: This is a JSP/Servlets web app deployed on Oracle 9iAS. And since I
am running in multiple environments (i.e. dev1, dev1, test, prod), I never
know where I'll be running so there is no way to preset the required env
vars.
I know there is no direct way to read Solaris env variables using JDK 1.4.2
but I think I should be able to use something like what's below to get at
them indirectly. The problem is that I always get a null myvar. Can anyone
help me?
Thanks so much.
Wells...
---------------------------
Process p = Runtime.getRuntime().exec("sh -l echo $JAVA_HOME");
BufferedReader br = new BufferedReader(new
InputStreamReader(p.getInputStream()));
String myvar = br.readLine();
System.out.println(myvar);
------------------------------
PS: This works on windows if I do:
Process p = Runtime.getRuntime().exec("cmd.exe /c echo %JAVA_HOME%");
PPS: This is a JSP/Servlets web app deployed on Oracle 9iAS. And since I
am running in multiple environments (i.e. dev1, dev1, test, prod), I never
know where I'll be running so there is no way to preset the required env
vars.