This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
[win32] Runtime.exec(String[] cmdarray, String[] envp)
- From: Marco Trudel <mtrudel at gmx dot ch>
- To: GCJ <java at gcc dot gnu dot org>
- Date: Sun, 17 Sep 2006 20:55:06 +0200
- Subject: [win32] Runtime.exec(String[] cmdarray, String[] envp)
Hello all
I use GCJ 4.2.0 (20060630) on linux and windows.
Runtime.exec(String[] cmdarray, String[] envp) doesn't set the
environment on windows but it works on linux.
This can be reproduced with the attached files (both compiled to
executables and CreateEnv calling PrintEnv).
Is this a known bug/problem? I didn't find anything on the gcc bugzilla
and the only thing google pointed out was something from ranjit
(http://www.advogato.org/person/rmathew/diary.html?start=97) what isn't
a problem in this case... Shall I make a bug report?
Has anyone an idea for a workaround?
Sorry for posting to this list instead of directly making bugreports. I
hope that someone who reads it has an idea while the [win32] bugreports
will more or less be ignored because of the lack of windows maintainers...
Marco
import java.io.*;
public class PrintEnv
{
public static void main(String[] args) throws Exception
{
FileWriter fw = new FileWriter("result.txt");
fw.write(System.getenv("FOO_BAR") + "\n");
fw.flush();
fw.close();
}
}
public class CreateEnv
{
public static void main(String[] args) throws Exception
{
String[] env = new String[] { "FOO_BAR=HelloWorld" };
Runtime.getRuntime().exec(new String[]{ "./PrintEnv.exe" }, env);
}
}