java 的hsperfdata_%USERNAME%文件夹不能自动生成原因解决

现象

使用jps不能查看java 的进程,使用visualVm不能监控到本地的java程序,并且提示"Local Applications Cannot Be Detected (Error Dialog On Startup)".


原因分析

java程序启动后,默认会在 %TEMP%/hsperfdata_%USERNAME% 目录下以该进程的id为文件名新建文件,并在该文件中存储jvm运行的相关信息,其中%TEMP%为wiondows系统的临时目录(在文件地址中输入"%TEMP%"即可跳转到此目录下);%USERNAME% 为当前的用户名(可通过cmd中输入echo %USERNAME% 查看).%TEMP%/hsperfdata_%USERNAME% 目录会存放该用户所有已经启动的java进程信息。


而jps、jconsole、jvisualvm等工具的数据来源就是这个文件(/%TEMP%/hsperfdata_%USERNAME%/pid)。所以当该文件不存在或是无法读取时就会出现jps无法查看该进程号.


解决

Local Applications Cannot Be Detected (Error Dialog On Startup)

Description: An error dialog saying that local applications cannot be detected is shown immediately after VisualVM startup.
Resolution: This can happen on Windows systems, it's caused by misconfigured jvmstat technology used to detect the running applications. There are two possible causes:
Insufficient permissions for %TMP%\hsperfdata_username folder - make sure you're able to create a file in the directory and eventually update the permissions for full folder access. Alternatively you can just re-create the folder which should automatically set the correct access rights. See see this forums.sun.com thread for more details.

Having %TMP%\hsperfdata_username folder on a FAT disk - by default jvmstat doesn't work on FAT disks due to security restrictions. You can bypass the security check by setting the -XX:+PerfBypassFileSystemCheck flag for both VisualVM and the monitored application. See the JDK bug #5042659 for more details.(访问地址:点击打开链接)

--- https://visualvm.java.net/troubleshooting.html#jpswin



  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值