Wednesday, January 20, 2010

Developing on Windows and jps

  In the last few months, I have been forced to develop using a Windows environment. I must admit I miss most of my linux/unix command prompt usage, among which is the "jps" tool.  For those of you not familiar with it, jps is a "process status" tool and is part of the jdk.  According to the documentation, this is an unsupported tool and comes with no guarantee, however I've found it to be a simple tool that can come in handy in certain situations as the one I'm about to describe.

  During my initial maven build, the test phase was throwing exceptions due an incorrect configuration.  As I tried to delete the target directory, windows reported the folder was in use.  Cygwin's "ps" command didn't reveal much.  Window's "Task Manager" wasn't really saying much either.  This is where "jps" brought light.  Jps reported the SurefireBoot.jar still hanging in there (apparently due to some unrelease resource). Unfortunately, the problem became even more serious as the reported PID was not that simple to kill (using Cygwin's kill command).


  As I researched some more on this, I came accross the following post where the issue of the TMP environment variable fixed some problems. As soon as I did this (setting the environment variable), I was able to resolve my problem (in my case, it was an issue with proper security in the TMP folder and its subfolders). This was not a "show-stopper", but certainly a nice to know as this TMP folder is not only used with jps, but also with jvisualvm, another nice free tool from the jdk.

No comments: