In order to find the name of Operating System in Java, there is a simple code :-
String os=System.getProperty("os.name").toLowerCase();
if(os.indexOf("win")>=0)
{ System.out.println("It is Windows System");
}
if(os.indexOf("uni")>=0)
{ System.out.println("It is a Unix System");
}
if(os.indexOf("lin")>=0)
{ System.out.println("It is a Linux System");
}
Hope you found this useful!!If you liked this article, please consider bookmarking or sharing it. Thanks!!
good work
ReplyDelete