61 |
// in vm/reference/java/lang/Runtime for implications of this fact. |
// in vm/reference/java/lang/Runtime for implications of this fact. |
62 |
|
|
63 |
/** |
/** |
64 |
|
* The System Class Loader (a.k.a. Application Class Loader). The one |
65 |
|
* returned by ClassLoader.getSystemClassLoader. It lives here to prevent |
66 |
|
* a circular initialization dependency between System and ClassLoader. |
67 |
|
*/ |
68 |
|
static final ClassLoader systemClassLoader; |
69 |
|
|
70 |
|
/** |
71 |
|
* Stores the current system properties. This can be modified by |
72 |
|
* {@link #setProperties(Properties)}, but will never be null, because |
73 |
|
* setProperties(null) sucks in the default properties. |
74 |
|
*/ |
75 |
|
static Properties properties; |
76 |
|
|
77 |
|
/** |
78 |
|
* The standard InputStream. This is assigned at startup and starts its |
79 |
|
* life perfectly valid. Although it is marked final, you can change it |
80 |
|
* using {@link #setIn(InputStream)} through some hefty VM magic. |
81 |
|
* |
82 |
|
* <p>This corresponds to the C stdin and C++ cin variables, which |
83 |
|
* typically input from the keyboard, but may be used to pipe input from |
84 |
|
* other processes or files. That should all be transparent to you, |
85 |
|
* however. |
86 |
|
*/ |
87 |
|
public static final InputStream in; |
88 |
|
|
89 |
|
/** |
90 |
|
* The standard output PrintStream. This is assigned at startup and |
91 |
|
* starts its life perfectly valid. Although it is marked final, you can |
92 |
|
* change it using {@link #setOut(PrintStream)} through some hefty VM magic. |
93 |
|
* |
94 |
|
* <p>This corresponds to the C stdout and C++ cout variables, which |
95 |
|
* typically output normal messages to the screen, but may be used to pipe |
96 |
|
* output to other processes or files. That should all be transparent to |
97 |
|
* you, however. |
98 |
|
*/ |
99 |
|
public static final PrintStream out; |
100 |
|
|
101 |
|
/** |
102 |
|
* The standard output PrintStream. This is assigned at startup and |
103 |
|
* starts its life perfectly valid. Although it is marked final, you can |
104 |
|
* change it using {@link #setErr(PrintStream)} through some hefty VM magic. |
105 |
|
* |
106 |
|
* <p>This corresponds to the C stderr and C++ cerr variables, which |
107 |
|
* typically output error messages to the screen, but may be used to pipe |
108 |
|
* output to other processes or files. That should all be transparent to |
109 |
|
* you, however. |
110 |
|
*/ |
111 |
|
public static final PrintStream err; |
112 |
|
|
113 |
|
/** |
114 |
* Add to the default properties. The field is stored in Runtime, because |
* Add to the default properties. The field is stored in Runtime, because |
115 |
* of the bootstrap sequence; but this adds several useful properties to |
* of the bootstrap sequence; but this adds several useful properties to |
116 |
* the defaults. Once the default is stabilized, it should not be modified; |
* the defaults. Once the default is stabilized, it should not be modified; |
282 |
if (defaultProperties.get("java.io.tmpdir") == null) |
if (defaultProperties.get("java.io.tmpdir") == null) |
283 |
defaultProperties.put("java.io.tmpdir", |
defaultProperties.put("java.io.tmpdir", |
284 |
defaultProperties.get("java.tmpdir")); |
defaultProperties.get("java.tmpdir")); |
|
} |
|
285 |
|
|
286 |
/** |
// Note that we use clone here and not new. Some programs assume |
287 |
* Stores the current system properties. This can be modified by |
// that the system properties do not have a parent. |
288 |
* {@link #setProperties(Properties)}, but will never be null, because |
properties = (Properties) Runtime.defaultProperties.clone(); |
289 |
* setProperties(null) sucks in the default properties. |
|
290 |
*/ |
in = VMSystem.makeStandardInputStream(); |
291 |
// Note that we use clone here and not new. Some programs assume |
out = VMSystem.makeStandardOutputStream(); |
292 |
// that the system properties do not have a parent. |
err = VMSystem.makeStandardErrorStream(); |
|
static Properties properties |
|
|
= (Properties) Runtime.defaultProperties.clone(); |
|
293 |
|
|
294 |
/** |
systemClassLoader = VMClassLoader.getSystemClassLoader(); |
|
* The standard InputStream. This is assigned at startup and starts its |
|
|
* life perfectly valid. Although it is marked final, you can change it |
|
|
* using {@link #setIn(InputStream)} through some hefty VM magic. |
|
|
* |
|
|
* <p>This corresponds to the C stdin and C++ cin variables, which |
|
|
* typically input from the keyboard, but may be used to pipe input from |
|
|
* other processes or files. That should all be transparent to you, |
|
|
* however. |
|
|
*/ |
|
|
public static final InputStream in = VMSystem.makeStandardInputStream(); |
|
295 |
|
|
296 |
/** |
String secman = properties.getProperty("java.security.manager"); |
297 |
* The standard output PrintStream. This is assigned at startup and |
if (secman != null) |
298 |
* starts its life perfectly valid. Although it is marked final, you can |
{ |
299 |
* change it using {@link #setOut(PrintStream)} through some hefty VM magic. |
if (secman.equals("") || secman.equals("default")) |
300 |
* |
{ |
301 |
* <p>This corresponds to the C stdout and C++ cout variables, which |
Runtime.securityManager = new java.lang.SecurityManager(); |
302 |
* typically output normal messages to the screen, but may be used to pipe |
} |
303 |
* output to other processes or files. That should all be transparent to |
else |
304 |
* you, however. |
{ |
305 |
*/ |
try |
306 |
public static final PrintStream out = VMSystem.makeStandardOutputStream(); |
{ |
307 |
|
Class cl = Class.forName(secman, false, systemClassLoader); |
308 |
/** |
Runtime.securityManager = (SecurityManager)cl.newInstance(); |
309 |
* The standard output PrintStream. This is assigned at startup and |
} |
310 |
* starts its life perfectly valid. Although it is marked final, you can |
catch (Exception x) |
311 |
* change it using {@link #setErr(PrintStream)} through some hefty VM magic. |
{ |
312 |
* |
throw (InternalError) |
313 |
* <p>This corresponds to the C stderr and C++ cerr variables, which |
new InternalError("Unable to create SecurityManager") |
314 |
* typically output error messages to the screen, but may be used to pipe |
.initCause(x); |
315 |
* output to other processes or files. That should all be transparent to |
} |
316 |
* you, however. |
} |
317 |
*/ |
} |
318 |
public static final PrintStream err = VMSystem.makeStandardErrorStream(); |
} |
319 |
|
|
320 |
/** |
/** |
321 |
* This class is uninstantiable. |
* This class is uninstantiable. |