I'm wondering if there's a way to determine which version of Linux I'm running (ie differentiate between RHEL4, RHEL5) from within the JVM. I'm just looking for a consistent way to differentiate between the operating systems and their versions.
The JVM gives you some basic information about the operating system via
System.getProperty()
"os.name" // OS name
"os.arch" // OS architecture
"os.version" // OS version
As far as I know it doesn't offers distribution specific information. At least for debian distributions this information is stored in a file called
/etc/issue
So it may help reading any of the files where the different distros store this information.
I do not believe there are any system properties you can look at that will give you that information. How about just executing a cat /proc/version
and parsing the output.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With