How to detect operating system in Java
In the following article, there is a short Java snippet that can be used to read the operating system of the computer running the Java program.
In addition, it is the first Java snippet at all here in the blog. Although I have been writing a few lines of Java code again and again for a couple of years, I really couldn’t befriend myself (especially with regard to my C # passion) with Java so far yet. But since I have to deal more and more with Java on the job, however, this will soon be reflected in the blog. But let’s come to the Snippet now…
Read operating system in Java
In order to identify the computer’s operating system in Java, the getProperty-method of the system-class is suitable. […]