object OSInfo {
def main(args: Array[String]): Unit = {
// Get the OS name
val osName = System.getProperty("os.name")
// Get the OS version
val osVersion = System.getProperty("os.version")
// Get the OS architecture
val osArch = System.getProperty("os.arch")
println(s"Operating System: $osName")
println(s"Version: $osVersion")
println(s"Architecture: $osArch")
}
}
/*
run:
Operating System: Linux
Version: 5.15.0-122-generic
Architecture: amd64
*/