Mac os 下打开java内存分析工具 mat

版权声明:欢迎传播,请标明出处。 https://blog.csdn.net/u201011221/article/details/83057567

下载MAT后, 解压得到mat.app, 但是直接点击打开出错, 显示错误信息在文件 /Users/along/.eclipse/762171948_macosx_cocoa_x86_64/configuration/1539580415773.log中.

1. 打开错误信息

cat /Users/along/.eclipse/762171948_macosx_cocoa_x86_64/configuration/1539580415773.log显示:

!SESSION 2018-10-15 13:13:35.692 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_181
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_CN
Framework arguments:  -keyring /Users/along/.eclipse_keyring
Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -keyring /Users/along/.eclipse_keyring

!ENTRY org.eclipse.osgi 4 0 2018-10-15 13:13:36.824
!MESSAGE Application error
!STACK 1
java.lang.IllegalStateException: The platform metadata area could not be written: /private/var/folders/6k/zthtjldx3p57hklv6rk636lr0000gn/T/AppTranslocation/A7533741-5F9A-499C-9ADA-6799A79C1AC3/d/mat.app/Contents/MacOS/workspace/.metadata.  By default the platform writes its content
under the current working directory when the platform is launched.  Use the -data parameter to
specify a different content area for the platform.
	at org.eclipse.core.internal.runtime.DataArea.assertLocationInitialized(DataArea.java:70)
	at org.eclipse.core.internal.runtime.DataArea.getStateLocation(DataArea.java:138)
	at org.eclipse.core.internal.preferences.InstancePreferences.getBaseLocation(InstancePreferences.java:44)
	at org.eclipse.core.internal.preferences.InstancePreferences.initializeChildren(InstancePreferences.java:209)
	at org.eclipse.core.internal.preferences.InstancePreferences.<init>(InstancePreferences.java:59)
	at org.eclipse.core.internal.preferences.InstancePreferences.internalCreate(InstancePreferences.java:220)
	at org.eclipse.core.internal.preferences.EclipsePreferences.create(EclipsePreferences.java:349)
	at org.eclipse.core.internal.preferences.EclipsePreferences.create(EclipsePreferences.java:337)
	at org.eclipse.core.internal.preferences.PreferencesService.createNode(PreferencesService.java:393)
	at org.eclipse.core.internal.preferences.RootPreferences.getChild(RootPreferences.java:60)
	at org.eclipse.core.internal.preferences.RootPreferences.getNode(RootPreferences.java:95)
	at org.eclipse.core.internal.preferences.RootPreferences.node(RootPreferences.java:84)
	at org.eclipse.core.internal.preferences.AbstractScope.getNode(AbstractScope.java:38)
	at org.eclipse.core.runtime.preferences.InstanceScope.getNode(InstanceScope.java:77)
	at org.eclipse.ui.preferences.ScopedPreferenceStore.getStorePreferences(ScopedPreferenceStore.java:225)
	at org.eclipse.ui.preferences.ScopedPreferenceStore.<init>(ScopedPreferenceStore.java:132)
	at org.eclipse.ui.plugin.AbstractUIPlugin.getPreferenceStore(AbstractUIPlugin.java:287)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:609)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:597)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.mat.ui.rcp.Application.start(Application.java:26)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:656)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:592)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1498)

重点是The platform metadata area could not be written: /private/var/folders/6k/zthtjldx3p57hklv6rk636lr0000gn/T/AppTranslocation/A7533741-5F9A-499C-9ADA-6799A79C1AC3/d/mat.app/Contents/MacOS/workspace/.metadata. By default the platform writes its content under the current working directory when the platform is launched. Use the -data parameter to specify a different content area for the platform.

需要使用 -data指定一个位置.

2. 指定data位置

在命令行执行 open, 显示帮助信息:

Usage: open [-e] [-t] [-f] [-W] [-R] [-n] [-g] [-h] [-s <partial SDK name>][-b <bundle identifier>] [-a <application>] [filenames] [--args arguments]
Help: Open opens files from a shell.
      By default, opens each file using the default application for that file.
      If the file is in the form of a URL, the file will be opened as a URL.
Options:
      -a                Opens with the specified application.
      -b                Opens with the specified application bundle identifier.
      -e                Opens with TextEdit.
      -t                Opens with default text editor.
      -f                Reads input from standard input and opens with TextEdit.
      -F  --fresh       Launches the app fresh, that is, without restoring windows. Saved persistent state is lost, excluding Untitled documents.
      -R, --reveal      Selects in the Finder instead of opening.
      -W, --wait-apps   Blocks until the used applications are closed (even if they were already running).
          --args        All remaining arguments are passed in argv to the application's main() function instead of opened.
      -n, --new         Open a new instance of the application even if one is already running.
      -j, --hide        Launches the app hidden.
      -g, --background  Does not bring the application to the foreground.
      -h, --header      Searches header file locations for headers matching the given filenames, and opens them.
      -s                For -h, the SDK to use; if supplied, only SDKs whose names contain the argument value are searched.
                        Otherwise the highest versioned SDK in each platform is used.

注意这里的–args 是可以传递参数的.

3. 最终执行命令

使用如下命令即可正常打开该mat.app. open -a mat.app --args -data ~/workplace/heapdump/

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏JAVA后端开发

JAVA实现编写平台代码生成器

[项目中经常写CRUD,但实际这些工作,我觉得如果有一个完整的代码规范,完全可以自动生成,加快开发效率. 代码生成器技术原理不复杂,一般就是写好一个模板生成一...

9122
来自专栏jeremy的技术点滴

SSM项目脚手架

4874
来自专栏Java3y

从零开始写项目第一篇【搭建环境】

使用Maven搭建SSM环境 SSM需要的基础jar包有哪些??整理一下: c3p0数据连接池 springMVC的JSON springAOP springC...

53510
来自专栏Lambda

编程规范

领域层–编码规范 2018年4月4日14:10:38 Controller层编写规范 controller层只是负责从service层获得数据,对外暴露API接...

3646
来自专栏码匠的流水账

使用RSQL实现端到端的动态查询

RSQL(RESTful Service Query Language)是Feed Item Query Language (FIQL) 的超集,是一种REST...

860
来自专栏为数不多的Android技巧

Android 插件化原理解析——Hook机制之AMS&PMS

在前面的文章中我们介绍了DroidPlugin的Hook机制,也就是代理方式和Binder Hook;插件框架通过AOP实现了插件使用和开发的透明性。在讲述Dr...

1311
来自专栏后端云

resize失败原因调查

对一个vm做resize,即从一个小的flavor换一个大的flavor,没有成功

1433
来自专栏IT笔记

SpringBoot开发案例之整合mongoDB

? mongodb.jpg 开始前,建议大家去了解以下文章,当然不看也没问题: MongoDB从入门到“精通”之简介和如何安装 MongoDB从入门到“精通”...

5648
来自专栏Java面试通关手册

从分析我抓取的60w知乎网民来学习如何在SSM项目中使用Echarts

去年在接触Java爬虫的时候,接触到了一个关于知乎的爬虫。个人觉得写的非常好,当时抓取的效率和成功率还是特别特别高,现在可能知乎反扒做的更好,这个开源知乎爬虫没...

2213
来自专栏个人分享

Spark代码调优(一)

import org.apache.spark.sql.{DataFrame, Row, SQLContext}

2241

扫码关注云+社区

领取腾讯云代金券