Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

2 Answers

up vote 0 down vote accepted

Process Monitor can also monitor file access

http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx

.

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
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.