{"id":4743,"date":"2014-03-30T15:02:50","date_gmt":"2014-03-30T15:02:50","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/how-to-write-java-program-get-pid-duplicate-collection-of-common-programming-errors\/"},"modified":"2014-03-30T15:02:50","modified_gmt":"2014-03-30T15:02:50","slug":"how-to-write-java-program-get-pid-duplicate-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/how-to-write-java-program-get-pid-duplicate-collection-of-common-programming-errors\/","title":{"rendered":"how to write java program get pid [duplicate]-Collection of common programming errors"},"content":{"rendered":"<p>You can do this using JMX, but beware. The below is not an officially supported mechanism and could change. However, I&#8217;ve used this in the past and it works fine.<\/p>\n<pre><code>RuntimeMXBean rmxb = ManagementFactory.getRuntimeMXBean();\nSystem.err.println(\"pid: \" + rmxb.getName());\n<\/code><\/pre>\n<p>will print {pid}@hostname<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can do this using JMX, but beware. The below is not an officially supported mechanism and could change. However, I&#8217;ve used this in the past and it works fine. RuntimeMXBean rmxb = ManagementFactory.getRuntimeMXBean(); System.err.println(&#8220;pid: &#8221; + rmxb.getName()); will print {pid}@hostname<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4743","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4743","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4743"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4743\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4743"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4743"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4743"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}