Well, just to through in my two cents, on most unix/linux variants you can identify processes that have a handle to a specific file, so the count of processes that currently have a file handle to rt.jar (in all of its various versions installed on the machine) should give you a somewhat accurate count of the running JVMs (unless someone is manually looking at one of the rt.jars with an editor or something).
;-)
But, I don't suggest this as the overhead in finding this out is not insignificant, and once again, why do you need the info.
> * And all other known, unknown and custom names of
> the Java launcher
> :)
I'll repeat: Guess. Not even an educated guess, shouting four might be just as reliable. But if you have a degree of control over the environment, and I think for many developer/desktops, this will give a reasonable acceptable result.
Message was edited by:
mlk
> Well, just to through in my two cents, on most
> unix/linux variants you can identify processes that
> have a handle to a specific file, so the count of
> processes that currently have a file handle to rt.jar
> (in all of its various versions installed on the
> machine) should give you a somewhat accurate count of
> the running JVMs (unless someone is manually looking
> at one of the rt.jars with an editor or something).
A good idea, but my app-server process does not appear to have *any* jar open.
[ebank2@giskard oc4j]$ ls -l /proc/10038/fd|grep jar
[ebank2@giskard oc4j]$ ps -p 10038
PID TTY TIME CMD
10038 ?00:00:01 java
[ebank2@giskard oc4j]$ ps -p 10038 -f
UIDPID PPID C STIME TTY TIME CMD
ebank210038 10034 0 Jan08 ?00:00:01 java -DUSR=ivan -classpath .:/opt/mqm/java/lib/com.ibm.mq.jar:/opt/mqm/j
> A good idea, but my app-server process does not
> appear to have *any* jar open.
>
>
> [ebank2@giskard oc4j]$ ls -l /proc/10038/fd|grep jar
> [ebank2@giskard oc4j]$ ps -p 10038
>PID TTY TIME CMD
> 038 ?00:00:01 java
> [ebank2@giskard oc4j]$ ps -p 10038 -f
> UIDPID PPID C STIME TTY TIME CMD
> ebank210038 10034 0 Jan08 ?00:00:01 java
> -DUSR=ivan -classpath
> .:/opt/mqm/java/lib/com.ibm.mq.jar:/opt/mqm/j
>
Aaaaaaaahhhhhhhh, Oh well. It was worth a try. I hadn't tried it myself, but I didn't figure that they would open the file everytime they needed to load a class, but I guess they do.