Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add parent pid field #30

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/target/
/nbactions.xml
/.classpath
/.project
/target/
/nbactions.xml
/.classpath
/.project
/.idea
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
language: java
jdk:
- oraclejdk8
language: java
jdk:
- oraclejdk8
404 changes: 202 additions & 202 deletions LICENSE

Large diffs are not rendered by default.

160 changes: 80 additions & 80 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
![](https://img.shields.io/maven-central/v/org.jprocesses/jProcesses.svg)
![](https://img.shields.io/github/license/profesorfalken/jProcesses.svg)
![](https://travis-ci.org/profesorfalken/jProcesses.svg)

# 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.4

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

<dependency>
<groupId>org.jprocesses</groupId>
<artifactId>jProcesses</artifactId>
<version>1.6.4</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.4/jProcesses-1.6.4.jar

The only dependency you will need to add to the classpath is [WMI4Java](https://repo1.maven.org/maven2/com/profesorfalken/WMI4Java). You can download de JAR file [here](https://repo1.maven.org/maven2/com/profesorfalken/WMI4Java/1.6.1/WMI4Java-1.6.1.jar).


## Basic Usage ##

#### Get processes details ####

```java
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 ####

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

#### Change process Priority ####

Unix/Mac:

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

Windows:

```java
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

@janhoy: for his contribution that fix long date parsing with locales different from english (Norwegian in his case)
![](https://img.shields.io/maven-central/v/org.jprocesses/jProcesses.svg)
![](https://img.shields.io/github/license/profesorfalken/jProcesses.svg)
![](https://travis-ci.org/profesorfalken/jProcesses.svg)
# 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.4
For example, for Maven you have just to add to your pom.xml:
<dependency>
<groupId>org.jprocesses</groupId>
<artifactId>jProcesses</artifactId>
<version>1.6.4</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.4/jProcesses-1.6.4.jar
The only dependency you will need to add to the classpath is [WMI4Java](https://repo1.maven.org/maven2/com/profesorfalken/WMI4Java). You can download de JAR file [here](https://repo1.maven.org/maven2/com/profesorfalken/WMI4Java/1.6.1/WMI4Java-1.6.1.jar).
## Basic Usage ##
#### Get processes details ####
```java
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 ####
```java
boolean success = JProcesses.killProcess(3844).isSuccess();
```
#### Change process Priority ####
Unix/Mac:
```java
boolean ok = JProcesses.changePriority(3844, 5).isSuccess();
```
Windows:
```java
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
@janhoy: for his contribution that fix long date parsing with locales different from english (Norwegian in his case)
Loading