Java pid from within program

Returns pid@hostname

RuntimeMXBean r = ManagementFactory.getRuntimeMXBean();
System.out.println("RuntimeMXBean=" + r.getName());


On linux

java -Dpid=$$ yourclass

Then java expression

System.getProperty("pid")

will give you the process id.

Comments

Popular posts from this blog

Sites, Newsletters, and Blogs

Oracle JDBC ReadTimeout QueryTimeout

Locks held on Oracle for hours after sessions abnormally terminated by node failure