0

I am writing a program to gather information specific to a laptop, linux server, desktop, workstation. The first step is to identify where my program is running. I am having trouble achieving this part. If you could point me in the right direction, would be very helpful.

I realize there might not be one solution and have to probably combine multiple solutions.

Thank you

Shashank
  • 247
  • 5
  • 17

1 Answers1

2

I would try and detect the battary status (no status means desktop). You can refer to this answer on how to accomplis this: Monitoring battery or power supply of laptop from java

Ofer Levi
  • 31
  • 3
  • One caveat is when a desktop uses a smart UPS (using USB to report capacity), modern operating systems will treat that like like a laptop battery. I use a CyberPower smart UPS and Win10 lets me set power options (like sleep and shutdown) based on battery levels. – Adam Howell Jul 17 '20 at 16:03