Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

829
Views
how to get running process information in java?

i want to get infomation about other running processes in my os. (two things, process 'name' and 'path'.)

now, i'm using linux command like a "ps command".

Process process = Runtime.getRuntime().exec("ps x")

but because i want to run this in windows too, i'm searching other function can be works in windows and linux.

there are any java class or function have not os dependency?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The updated Process API in Java 9 through JEP 102 will help you if you're willing to upgrade early... This provides platform agnostic access to process trees...

See ProcessHandle.allProcesses()

Example

ProcessHandle.allProcesses().forEach(processHandle -> 
    System.out.println("PID: " + processHandle.getPid() + 
    ", command: " + processHandle.info().command().orElse("Unknown")));
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!