Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a .jar file that I would like to check if it gets called/executed. The program that is supposed to access it is visual studio post build events, but I have no idea if it gets executed.

My OS is Windows 7.

share|improve this question
up vote 0 down vote accepted

Process Monitor can also monitor file access


share|improve this answer
I've been figuring out how to use this. Do you have any steps or procedures on how to do this? – Shawn Mclean Sep 8 '10 at 1:27
If you run PM, it shows what files are being access in real time, the operation column shows "Read File" and then look at the Path column. You can set up a filter to record only the events you want. There is a help file included with the program also. – Moab Sep 8 '10 at 14:29

Depending on exactly how Visual Studio is running the JAR, you might be able to simply rename the JAR and see if the build breaks.

It's one thing to detect if the JAR file is opened (try Process Monitor), but to see if the specified Main-Class is actually loaded and its byte code executed, you'd need to hook into the JVM with a debugger or instrumentation. That requires some switches passed to the JVM at startup.

As a post-build task, I'd guess the process runs without intervention, and perhaps very quickly, so you'd need to suspend on startup (also possible with startup switches) in order to hook into it.

A lower-tech approach would be to replace the JAR with something that does something very obvious, like display a message or leave a file. You could even take the existing JAR, and modify it slightly so that it runs the "Hello, Obvious" class first, then calls the original class to do what it is supposed to.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .