This seems to be a real issue with java and external processes
the following on windows 7 and java 7 (32bit)
ProcessBuilder b = new ProcessBuilder(); Map<String, String> env = b.environment(); for (String key : env.keySet()) System.out.println(key + ": " + env.get(key)); produces
SystemRoot: C:\Windows Path: xbox which means the running programs environment and the subprocesses environment should contain a path variable, that has exactly the value 'xbox' (e.g. nonsense, there is no directory named xbox anywhere on my pc)
just for protocol:
Map<String, String> env = System.getenv(); for (String key : env.keySet()) System.out.println(key + ": " + env.get(key)); gives exactly the same result.
when I run
b.command("convert.exe", "/?").inheritIO().start(); with this process builder and environment I get
Konvertiert FAT-Volumes in NTFS. CONVERT Volume /FS:NTFS [/V] [/CvtArea:Dateiname] [/NoSecurity] [/X] Volume Bestimmt den Laufwerkbuchstaben (gefolgt von einem Doppelpunkt), den Bereitstellungspunkt oder das Volume. /FS:NTFS Bestimmt das in NTFS zu konvertierende Volume. /V Legt fest, dass CONVERT im ausf�hrlichen Modus ausgef�hrt wird. /CvtArea:Dateiname Bestimmt die zusammenh�ngende Datei im Stammverzeichnis, die als Platzhalter f�r NTFS-Systemdateien dienen soll. /NoSecurity Bestimmt die Sicherheitseinstellungen f�r konvertierte Dateien und Verzeichnisse, die f�r jeden Benutzer zug�nglich sind. /X Erzwingt ggf. das Aufheben der Bereitstellung. Alle ge�ffneten Handles auf das Volume sind in diesem Fall ung�ltig. this is the (german) output of
C:\Windows\System32\convert.exe The same happens when I use
Runtime.getRuntime().exec(new String[]{"convert.exe", "/?"}); And note that my environment is so small because I replaced the native enviroment. That means the whole program has exactly those two environment variables.