1 // Verify we can modify the environment.
2 import java
.io
.BufferedReader
;
3 import java
.io
.InputStream
;
4 import java
.io
.InputStreamReader
;
11 public static void main(String
[] args
)
15 ProcessBuilder pb
= new ProcessBuilder("env");
16 Map
<String
, String
> e
= pb
.environment();
18 String v
= "process7_value";
19 String k
= "PROCESS_7_KEY";
21 Process p
= pb
.start();
22 InputStream is
= p
.getInputStream();
23 InputStreamReader isr
= new InputStreamReader(is
);
24 BufferedReader br
= new BufferedReader(isr
);
25 boolean found
= false;
28 while ((result
= br
.readLine()) != null)
30 if (result
.equals(k
+ '=' + v
))
35 System
.out
.println("bad");
38 System
.out
.println("ok");
42 System
.out
.println(ex
.toString());