Hi, to know the activation of an external application how to proceed in java?. I mean consider for example you are opening a browser. from opening the browser till it gets activated it will take some time. How can i get this activation time?. The basic problem i am looking at is how to synchronize the two, my java application that is trying to open the application and the external application. thanks in advance
Also remember that just because a call to run a program returns, it does not guarantee the program is executing. It may have failed immediately with error messages, or returned immediately because it only allows one instance and one is already running.
Joined: Sep 16, 2004
Can you send me your busness requirment?
May be someone may suggess you better way.
pavan kumar singaraju
Joined: Aug 29, 2005
A Project in Linux is requiring this particular approach for optimizing the Linux kernal. They are documenting the various approaches of finding the above said one. i.e., to optimize the some kernal process handling things, they need to find how much time is being taken for the application to get activated is needed. In that process they enquired how can it be done in java and i too wanted as it is an interesting exploration. I thought of sharing of knowledge here in javaranch. This is the sinerio for this querry.
This is really silly. Optimizing a kernel by launching a browser and timing how long till it appears -- in Java?
Let's break this down, shall we?
1) The vast majority of the work of launching a browser is done in user space, not kernel space.
2) The timing is strongly dependent on what else is running, the state of VM, graphics memory, etc. There's simply no way you'd ever get meaningful results that meant anything outside of the one test machine.
3) Java has no way to interact with the windows of other applications, so to do this in Java, you'd have to use native code -- so why use Java?
4) Java, being a garbage collected language, is a bad choice for precise timing of anything, let alone another process.
5) The tiny timing differences due to kernel optimizations would be absolutely swamped by the timing differences due to the fact that you're timing one process via messages passed to another process. The only way you could possibly get useful results would be by instrumenting the browser app itself -- otherwise you'd end up optimizing the kernel's scheduler to minimize the time between browser launch and timing measurement.