Java : Getting Operating System Information

java

In some certain cases, application that we are developing need to know the information of operating system where it has been installed. The purpose of doing that may vary depends on the requirements. In this short blog post i will write about how to get information of operating system using Java like Operating system name, version and architecture.

Java came with built in class to get operating system information, this class is java.lang.System, we will absolutely use this. This class has getProperty method with some keys as parameters as below :

  • os.name : to get operating system name
  • os.version : to get the version number of operating system
  • os.arch : to get operating system architecture

So, here’s the code

In my laptop here’s the result

It is very easy, isn’t it? 😀
Happy Coding!!!

Facebook Comments
 

Agung Setiawan

Agung Setiawan adalah software engineer di BukaLapak.com, penulis sekaligus pecinta sastra, dan pembaca buku

 
Halo, perkenalkan saya Agung Setiawan.
Saya Software Engineer di BukaLapak.
Simak pemikian saya soal dunia Software Engineering via Twitter di @agungsetiawanmu dan facebook
Blog ini saya update seminggu sekali jadi sering-sering saja mampir
Mau belajar Vim bareng saya?
Belajar ngoding dari nol menggunakan PHP

Leave a Reply

Your email address will not be published. Required fields are marked *