I want my Java program or say some method within my class to be triggered when i s开发者_如何学运维tart some Windows program(Application) .For example i want my program start executing(Trigger) when i start Realplayer.
Here is a psuedo-code of what you have to do:
- Java application (Listener), registered as a Windows Service and runs on system stratup.
- Listener application keep listening until some .exe file is opened.
- Listener execute code (or call another application)
I think you need to make a jar and then use some sort of Java Service Wrapper.... Still not sure.
What you actually require is to register a service in the Windows services.
You can easily do this with DOS...
@echo off
start path\to\someApplication
start path\to\javaApplication
Enter the above code in notepad and save it as whateverNameYouWant.bat
When you run it, the batch file will launch the application you specified in the code AND the Java (.jar
) application you specified in the code.
精彩评论