前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Mac os 下打开java内存分析工具 mat

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

原创
作者头像
望天
发布2019-09-26 13:36:07
1.6K0
发布2019-09-26 13:36:07
举报
文章被收录于专栏:along的开发之旅

下载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显示:

代码语言:txt
复制
!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, 显示帮助信息:

代码语言:txt
复制
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/

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1. 打开错误信息
  • 2. 指定data位置
  • 3. 最终执行命令
相关产品与服务
对象存储
对象存储(Cloud Object Storage,COS)是由腾讯云推出的无目录层次结构、无数据格式限制,可容纳海量数据且支持 HTTP/HTTPS 协议访问的分布式存储服务。腾讯云 COS 的存储桶空间无容量上限,无需分区管理,适用于 CDN 数据分发、数据万象处理或大数据计算与分析的数据湖等多种场景。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档