I've just started learning Java. I have installed Oracle's Java 16 on my OpenSuSE desktop machine, and I wrote this little program to display System properties:
import java.io.Console; public class ShowSystem {public static void main(String[] args) {Console console = System.console(); String path_separator = System.getProperty("file.separator"); String file_separator = System.getProperty("java.class.path"); String line_separator = System.getProperty("java.home"); String java_class_path = System.getProperty("java.vendor"); String java_home = System.getProperty("java.vendor.url"); String java_vendor = System.getProperty("java.version"); String java_vendor_url = System.getProperty("line.separator"); String java_version = System.getProperty("os.arch"); String os_arch = System.getProperty("os.name"); String os_name = System.getProperty("os.version"); String os_version = System.getProperty("path.separator"); String user_dir = System.getProperty("user.dir"); String user_home = System.getProperty("user.home"); String user_name = System.getProperty("user.name"); console.format(" Path separator = %s%n", path_separator); console.format(" File separator = %s%n", file_separator); console.format(" Line separator = %s%n%n", line_separator); console.format("Java class path = %s%n", java_class_path); console.format("Java home = %s%n", java_home); console.format("Java vendor = %s%n", java_vendor); console.format("Java vendor url = %s%n", java_vendor_url); console.format("Java version = %s%n%n", java_version); console.format("Os architecture = %s%n", os_arch); console.format("Os name = %s%n", os_name); console.format("Os version = %s%n%n", os_version); console.format("User directory = %s%n", user_dir); console.format("User home = %s%n", user_home); console.format("User name = %s%n", user_name); } }
It shows some bizarre settings for file.separator and line.separator, that I think are attributable to the path.separator property:
$ java ShowSystem Path separator = / File separator = .:/home/leslie/bin/NetRexx/:/usr/java/jdk-16.0.1/bin/java:/usr/local/NetRexx/lib/NetRexxF.jar Line separator = /usr/java/jdk-16.0.1 Java class path = Oracle Corporation Java home = https://java.oracle.com/ Java vendor = 16.0.1 Java vendor url = Java version = amd64 Os architecture = Linux Os name = 5.3.18-59.19-default Os version = : User directory = /home/leslie/Documents/SourceCode/Languages/Java/Tutorials User home = /home/leslie User name = leslie
Actually, looking at the output again, quite a few of these values (java.*, os.*) seem suspect as well. :-)
Is this something I can correct myself, or does Oracle need to do it?
Leslie
--- Update ---
Hmmm... but it looks like maybe version 16 has replaced System.getProperty() with getSystemProperties() in java.lang.management? (At least, that's what Oracle's search page pointed me to.)