Java : Getting Operating System Information


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 :

  • : 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, penulis sekaligus pecinta sastra, dan pembaca buku

Halo, perkenalkan saya Agung Setiawan.
Seorang Software Engineer di BukaLapak, penulis buku, blogger, gunpla builder, tech educator.
Simak pemikiran saya soal dunia Software Engineering via Twitter di @agungsetiawanmu dan facebook
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 *