Lightweight fork of SystemUtils.java from Apache Commons Lang
<dependency>
<groupId>com.harium.util</groupId>
<artifactId>os-detector</artifactId>
<version>1.0.0</version>
</dependency>
Use it as Apache Commons Lang:
if (SystemUtils.IS_OS_WINDOWS) {
// do something
} else {
// do something
}
Or with OSDetector:
if (OS.Linux == OSDetector.getOS()) {
// do something
} else {
// do something
}