How can I prevent Java from creating hsperfdata files?

后端 未结 8 1911
遥遥无期
遥遥无期 2020-12-24 02:15

I\'m writing a Java application that runs on Linux (using Sun\'s JDK). It keeps creating /tmp/hsperfdata_username directories, which I would like to prevent. Is

8条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-24 02:54

    Rather than switching it off, change the java.io.tmpdir location. Add -Djava.io.tmpdir=/mydir/somewhere/else/ to your Java startup command and then the file will be somewhere that you control.


    Note a comment by @simonc: this only works in a few versions of the JVM and is no longer supported. See http://bugs.sun.com/view_bug.do?bug_id=6447182, http://bugs.sun.com/view_bug.do?bug_id=6938627, http://bugs.sun.com/view_bug.do?bug_id=7009828 for more information.

提交回复
热议问题