Giter Club home page Giter Club logo

jprocesses's Introduction

jProcesses

Get crossplatform processes details with Java

Installation

To install jProcesses you can add the dependecy to your software project management tool: http://mvnrepository.com/artifact/org.jprocesses/jProcesses/1.6.2

For example, for Maven you have just to add to your pom.xml:

  <dependency>
         <groupId>org.jprocesses</groupId>
         <artifactId>jProcesses</artifactId>
     	<version>1.6.2</version>
  </dependency>

Instead, you can direct download the JAR file and add it to your classpath. http://central.maven.org/maven2/org/jprocesses/jProcesses/1.6.2/jProcesses-1.6.2.jar

The only dependency you will need to add to the classpath is WMI4Java. You can download de JAR file here.

Basic Usage

Get processes details

    List<ProcessInfo> processesList = JProcesses.getProcessList();
    
    for (final ProcessInfo processInfo : processesList) {
        System.out.println("Process PID: " + processInfo.getPid());
        System.out.println("Process Name: " + processInfo.getName());
        System.out.println("Process Time: " + processInfo.getTime());
        System.out.println("User: " + processInfo.getUser());
        System.out.println("Virtual Memory: " + processInfo.getVirtualMemory());
        System.out.println("Physical Memory: " + processInfo.getPhysicalMemory());
        System.out.println("CPU usage: " + processInfo.getCpuUsage());
        System.out.println("Start Time: " + processInfo.getStartTime());
        System.out.println("Priority: " + processInfo.getPriority());
        System.out.println("Full command: " + processInfo.getCommand());
        System.out.println("------------------");
    }

Kill process by PID

    boolean success = JProcesses.killProcess(3844).isSuccess();

Change process Priority

Unix/Mac:

    boolean ok = JProcesses.changePriority(3844, 5).isSuccess();

Windows:

    boolean ok = JProcesses.changePriority(3844, WindowsPriority.HIGH).isSuccess();

More info

Webpage: http://www.jprocesses.org

Special thanks

@jkuharev: for his help to make jProcess work on Mac

@Gobliins: for fixing executeCommand hang with lots of process using ProcessBuilder

jprocesses's People

Contributors

dmgburg avatar profesorfalken avatar

Watchers

 avatar  avatar

Forkers

renovate-bot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.