当Java应用出现内存溢出的问题的时候,需要拿工具分析dump文件的。JDK自带的jvisualvm和jhat都可以使用,另外还有一个工具是 Memory Analyzer Tool ,支持独立运行和作为Eclipse插件两种方式使用。

因为已经不再使用Eclipse,所以这次准备在MacBook上装一个独立运行的版本,碰到了一点坑,mark一下。

1 下载

官网是 http://liaojunyong.spaces.live.com ,当前最新版本是 1.9.1,选择下载 Mac OSX (Mac/Cocoa/x86_64) 版。下载后解压为目录 mat.app 。

2 移动到/Applications

当前这个目录在 Downloads 目录中,运行不方便,考虑将其移动到应用程序中。打开控制台,输入命令

Downloads % cd /Applications
/Applications %
/Applications %sudo mv /Users/<username>/Downloads/mat.app .

输入管理员密码后移动成功。进入启动台就能看到应用mat了。

如果直接点击mat应用,会启动失败,提示我们去查看日志文件

.eclipse/1005214708_macosx_cocoa_x86_64/configuration/1578452593396.log,其主要内容为

java.lang.IllegalStateException:
The platform metadata area could not be written:
/private/var/folders/_h/mmd26ldd751g7gnx6wjfghzw0000gn/T/AppTranslocation/47640E19-535C-4C8D-84DA-8D0DDA56BFD4/d/mat.app/Contents/MacOS/workspace/.metadata.
By default the platform writes its contentunder the current working directory when the platform is launched.
Use the -data parameter to specify a different content area for the platform.

提示我们需要使用参数 -data 指定一个工作空间。

3 修改配置文件

我们先创建一个 workspace目录,比如我直接创建在其安装目录下,完整路径为

/Applications/mat.app/Contents/MacOS/workspace

然后使用文本编辑器编辑文件 /Applications/mat.app/Contents/Info.plist 找到<array>部分,修改内容为

<array>
<!-- 指定启动使用的JVM -->
<string>-vm</string>
<string>/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home/bin/java</string>
<!-- 指定启动的工作空间 -->
<string>-data</string>
<string>/Applications/mat.app/Contents/MacOS/workspace</string>
<!-- 原有内容,不动 -->
<string>-keyring</string>
<string>~/.eclipse_keyring</string>
</array>

然后在运行mat.app,启动成功。

最新文章

  1. Boost信号/槽signals2
  2. linux大文件分割 split命令
  3. 在线免费生成 &lt;IDEA&gt;全系列 注册码
  4. Java中String、StringBuffer、StringBuilder区别与理解
  5. setInterval对某个数值加加渐减
  6. [翻译] java NIO Buffer
  7. cpu,内存,虚拟内存,硬盘,缓存之间是什么关系??
  8. IOS中GPS定位偏移纠正(适用于Google地图)
  9. POJ 1195 2维线段树(树套树实现) 树状数组
  10. 并行开发——Parallel的使用 -摘自网络
  11. Linux screen命令简介
  12. ERROR: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in &#39;zookeeper.znode.parent&#39;. There could be a mismatch with the one configured in the
  13. chmod u+s(转)
  14. Springboot security cas源码陶冶-CasAuthenticationFilter
  15. 开源介绍&#183;新款简约、实用与大气的Hexo新主题:BMW
  16. 在线客服兼容谷歌Chrome、苹果Safari、Opera浏览器的修改
  17. 通过junit/TestNG+java 实现自动化测试
  18. canvas的认识,时钟的设置
  19. vue 非父子组件传值
  20. hadoop伪分布式环境搭建之linux系统安装教程

热门文章

  1. Pyspider的基本使用 -- 入门
  2. 图片转换到指定大小PDF
  3. 基于 QEMU进行 arm 仿真开发 (以 vexpress-a9 为例)
  4. (转)浅谈 Linux 内核无线子系统
  5. call 和 apply 用法
  6. Day5-T3
  7. GoJS组织结构图
  8. java实现下划线转驼峰
  9. 查看Python安装目录 -- 一个命令
  10. 利用python模拟鼠标点击自动完成工作,提升你的工作效率!