The Source for Java Technology Collaboration
User: Password:
Register | Login help    

Search

Online Books:
java.net on MarkMail:


Introducing Winp: Windows Process Manipulation Library

Posted by kohsuke on March 16, 2008 at 6:23 PM PDT

I wrote a library called winp that lets you do lower-level process managements on Windows. So far it includes things like killing random processes (not just the ones you launched), killing a process recursively, or finding out the environment variables and command line arguments given to the process.

My short-term goal is to use this in Hudson so that I can clean up the run-away processes (which are often left by jobs that deal with daemons like application servers), but I thought this kind of features would hopefully be useful for other applications.

In this library, I created a DLL without linking to the C runtime library, which helps me keep the DLL file size rather small (currently around 6K.) To use this library, just put winp.jar in your classpath — As with all my other projects that deal with JNI (like com4j), there's no need to deal with a DLL separately.

Related Topics >> Java Tools      
Comments
Comments are listed in date ascending order (oldest first)

MIT license. I updated the project site with this info.

I took a look at the winp native code a few weeks ago and it looked like you could also implement it using JNA. No need for another native DLL. It might also be interesting to build out your library further, just as the JRuby folks are doing with their POSIX layer built on top of JNA.

djhagberg — yes, the entire source code is in the Subversion repository of the project. I'll post a separate note about how to create a small DLL. trembovetski — Right. I guess I should have said "kill processes of your choice at will."

I would like to use it in my work, may I know what license is used for Winp? Thank you.

I think in this situation, JNI was appropriate. This only works on 32bit Windows anyway, and JNA would have made this 10 times bigger.

Very nice. Do you have the source and notes on how you built the nice small .dll? MSVC? Gnu toolchain? The -sources.jar just has the .dll in it, none of the native code. Thanks for all the excellent work! -=- D. J.

So far it includes things like killing random processes

Mmm, killing random processes! Sounds like a new variant of Russian Roulette! =)

Dmitri

Hello! Thank you for this very good piece of code. I'd like to add some functions to the DLL in order to monitor memory consumption of processes. However, I cannot find the source code of the winp.dll. Could you point me to that? Thanks a lot.