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

Oracle JDBC ReadTimeout QueryTimeout

Sites, Newsletters, and Blogs

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