I want to analyze the hprof file using the MAT API with the following code,
File hprofFile = new File(hprofPath);
try {
snapshot = SnapshotFactory.openSnapshot(hprofFile, null, progressListener);
} catch (SnapshotException e) {
throw new IllegalArgumentException("Failed to load HPROF file: " + hprofPath, e);
}
But an exception occurred,
Caused by: java.lang.NullPointerException: Cannot invoke "org.eclipse.core.runtime.IExtensionRegistry.getExtensionPoint(String)" because the return value of "org.eclipse.core.runtime.Platform.getExtensionRegistry()" is null
at org.eclipse.mat.snapshot.SnapshotFactory.(SnapshotFactory.java:88)
... 2 more
It seems that the Eclipse runtime environment is missing, and need to manually initialize the Platform and add the complete dependencies.
Are there any solutions to this problem? For example, is there a decoupled MAT API available? Thanks.