hi!
> Actually, it's about how to find the process id of the java process from
> that java source itself. With Process and Runtime classes, we can find the
> total amount of memory in the JVM. Like that, how to get the process id of
> itself from the code?
if you're on linux, something like this may help:
sh-2.05$ cat /proc/self/stat&
[1] 6718
sh-2.05$ 6718 (cat) R 6615 6718 28474 34817 6615 0 24 0 87 0 1 0 0 0 15 0 0 0 23594732
1245184 95 4294967295 134512640 134520135 3221219392 3221218972 1074618132 0 0 0 0 0 0
0 17 0
echo $!
6718
[1]+ Done cat /proc/self/stat
sh-2.05$
;; pid is the first word of what can be read from the /proc/self/staf
;; ppid can be found as the following number,etc...
=> doing this in java is just the same, but only have to be careful about
thread id <-> process id distinction.
on solaris, and other unix flavors things are a bit different but still
similar ideas can apply (in the worst case, you can write a unix
device driver which simply does the same as above, and java side of
the code only have to open-read-close the deivce file)...
regards,
kenji
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".