下载mac版本mat解压后,直接双击 mat ,报如下错误:
按照路径顺藤摸瓜查看1547775757896.log,观察到以下异常:
!SESSION 2020-03-15 20:59:38.921 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_201
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=zh_CN
Framework arguments: -keyring /Users/yourname/.eclipse_keyring
Command-line arguments: -os macosx -ws cocoa -arch x86_64 -keyring /Users/yourname/.eclipse_keyring
!ENTRY org.eclipse.osgi 4 0 2020-03-15 20:59:43.930
!MESSAGE Application error
!STACK 1
java.lang.IllegalStateException: The platform metadata area could not be written: /private/var/folders/sn/9z70jtvx79s37kvnd9b_732h0000gq/T/AppTranslocation/7275F3C2-2ACC-4A4D-A418-EA877D7CA885/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)
原因:
/private/var/folders/sn/9z70jtvx79s37kvnd9b_732h0000gq/T/AppTranslocation/7275F3C2-2ACC-4A4D-A418-EA877D7CA885/d/mat.app/Contents/MacOS/workspace/.metadata是只读文件
解决方案:
1.右键点击mat.app,选择显示包内容
2.进入eclipse文件夹,打开 MemoryAnalyzer.ini
3.添加data相关信息
-data
/Users/yourname/mat-log
4.再次打开mat即可正常使用
-
注意事项
- data参数和路径必须在两个不同的行
-
data参数必须放在Laucher之前,否则启动还是不成功
MemoryAnalyzer.ini修改后的文件内容如下: