forked from janbodnar/Java-Advanced
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPropsEnv.java
More file actions
26 lines (17 loc) · 692 Bytes
/
PropsEnv.java
File metadata and controls
26 lines (17 loc) · 692 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.zetcode;
public class PropsEnv {
public static void main(String[] args) {
var path = System.getenv("PATH");
String[] directories = path.split(";");
for (var directory : directories) {
System.out.println(directory);
}
System.out.printf("There are %d items in the PATH variable%n", directories.length);
String os_version = System.getProperty("os.name");
String java_version = System.getProperty("java.version");
String java_home = System.getProperty("java.home");
System.out.println(os_version);
System.out.println(java_version);
System.out.println(java_home);
}
}