<p>I'm writing a Java application that runs on Linux (using Sun's JDK). It keeps creating <code>/tmp/hsperfdata_username</code> directories, which I would like to prevent. Is there any way to stop java from creating these files?</p>

[{'answer_id': 76418, 'author': 'svrist', 'author_id': 86, 'author_profile': 'https://Stackoverflow.com/users/86', 'pm_score': 1, 'selected': False, 'text': '<p><em>EDIT: Cleanup info and summarize</em></p>\n\n<p>Summary:</p>\n\n<ul>\n<li>Its a feature, not a bug</li>\n<li>It can be turned of with -XX:-UsePerfData which might hurt performance</li>\n</ul>\n\n<p>Relevant info:</p>\n\n<ul>\n<li><a href="http://forums.sun.com/thread.jspa?threadID=587299&amp;messageID=4257939" rel="nofollow noreferrer">Sun forum</a></li>\n<li><a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5012932" rel="nofollow noreferrer">Bugreport</a></li>\n</ul>\n'}, {'answer_id': 76423, 'author': 'Kyle Renfro', 'author_id': 8187, 'author_profile': 'https://Stackoverflow.com/users/8187', 'pm_score': 6, 'selected': True, 'text': '<p>Try JVM option <strong>-XX:-UsePerfData</strong></p>\n\n<p><a href="http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html" rel="noreferrer">more info</a></p>\n\n<p>The following might be helpful that is from link <a href="https://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html" rel="noreferrer">https://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html</a></p>\n\n<pre><code>-XX:+UsePerfData\n\n    Enables the perfdata feature. This option is enabled by default\n    to allow JVM monitoring and performance testing. Disabling it \n    suppresses the creation of the hsperfdata_userid directories. \n    To disable the perfdata feature, specify -XX:-UsePerfData.\n</code></pre>\n'}, {'answer_id': 76503, 'author': 'Stu Thompson', 'author_id': 2961, 'author_profile': 'https://Stackoverflow.com/users/2961', 'pm_score': 1, 'selected': False, 'text': '<p>From svrist\'s link:</p>\n\n<blockquote>\n  <p>The first item in <a href="http://java.sun.com/performance/jvmstat/faq.html" rel="nofollow noreferrer">http://java.sun.com/performance/jvmstat/faq.html</a> mentions an option which you can turn off to disable the whole suite of features: -XX:-UsePerfData.</p>\n</blockquote>\n'}, {'answer_id': 76506, 'author': 'SCdF', 'author_id': 1666, 'author_profile': 'https://Stackoverflow.com/users/1666', 'pm_score': 1, 'selected': False, 'text': '<p>According to the <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5012932" rel="nofollow noreferrer">filed bug report</a> there is a work-around:</p>\n<blockquote>\n<p>This undocumented option will disable\nthe perfdata feature:<br />\n-XX:-UsePerfData</p>\n</blockquote>\n<p>It\'s worth mentioning that it is a feature though, not a bug. The above work-around just disables the feature.</p>\n'}, {'answer_id': 3060276, 'author': 'Zweiberg', 'author_id': 369132, 'author_profile': 'https://Stackoverflow.com/users/369132', 'pm_score': 2, 'selected': False, 'text': '<p>There is also <code>"-XX:+PerfDisableSharedMem"</code> option (recommended by Sun) which should cause less performance issues than use of <code>"-XX:-UsePerfData"</code> option.</p>\n'}, {'answer_id': 3933583, 'author': 'Jon Stafford', 'author_id': 277208, 'author_profile': 'https://Stackoverflow.com/users/277208', 'pm_score': 5, 'selected': False, 'text': '<p>Use the JVM option <strong><code>-XX:-UsePerfData</code></strong>.</p>\n\n<p>This will not have a negative effect on performance, as some other answers say.</p>\n\n<p>By default jvmstat instrumentation is turned on in the HotSpot JVM.  The JVM option <code>-XX:-UsePerfData</code> turns it off.  If anything, I would speculate, turning off the instrumentation would improve performance (a trivial amount).</p>\n\n<p>So the downside of turning off jvmstat instrumentation is that you lose the performance monitoring information.</p>\n\n<p>jvmstat is described here <a href="http://java.sun.com/performance/jvmstat/" rel="noreferrer">http://java.sun.com/performance/jvmstat/</a></p>\n\n<p>Here\'s a thread with someone who is worried that by turning <strong>on</strong> jvmstat - with the option <code>-XX:+UsePerfData</code> - will hurt performance.\n<a href="http://www.theserverside.com/discussions/thread.tss?thread_id=33833" rel="noreferrer">http://www.theserverside.com/discussions/thread.tss?thread_id=33833</a><br>\n(It probably won\'t since jvmstat is designed to be "\'always on\', yet has negligible performance impact".)</p>\n'}, {'answer_id': 5435817, 'author': 'Mack', 'author_id': 455512, 'author_profile': 'https://Stackoverflow.com/users/455512', 'pm_score': 2, 'selected': False, 'text': '<p>Rather than switching it off, change the java.io.tmpdir location.\nAdd -Djava.io.tmpdir=/mydir/somewhere/else/ to your Java startup command\nand then the file will be somewhere that you control.     </p>\n\n<hr>\n\n<p>Note a comment by @simonc:  this only works in a few versions of the JVM and is no longer supported. See <a href="http://bugs.sun.com/view_bug.do?bug_id=6447182" rel="nofollow">http://bugs.sun.com/view_bug.do?bug_id=6447182</a>, <a href="http://bugs.sun.com/view_bug.do?bug_id=6938627" rel="nofollow">http://bugs.sun.com/view_bug.do?bug_id=6938627</a>, <a href="http://bugs.sun.com/view_bug.do?bug_id=7009828" rel="nofollow">http://bugs.sun.com/view_bug.do?bug_id=7009828</a> for more information.</p>\n'}, {'answer_id': 52630279, 'author': 'user6494409', 'author_id': 6494409, 'author_profile': 'https://Stackoverflow.com/users/6494409', 'pm_score': 2, 'selected': False, 'text': '<p>As an addendum to Mack\'s reply (answered Mar 25 \'11 at 17:12), the option java.tmp.dir looks no longer available since Java 8.  See the info at: <a href="https://bugs.java.com/view_bug.do?bug_id=8189674" rel="nofollow noreferrer">https://bugs.java.com/view_bug.do?bug_id=8189674</a></p>\n\n<p>So disabling the option using -XX:-UsePerfData seems the only option not to have hsperfdata_* files.</p>\n'}]
['https://Stackoverflow.com/questions/76327', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/13582/']