从 Eclipse 运行 Visual VM

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25805204/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 21:58:02  来源:igfitidea点击:

Running Visual VM from eclipse

javaeclipseprofilervisualvm

提问by Anushree Acharjee

I am trying to debug a java app using Visual VM in Eclipse kepler. I am executing the class having main method selecting Visual VM as launcher. I have configured Visual VM as per the instructions given in http://blog.idrsolutions.com/2013/05/setting-up-visualvm-in-under-5-minutes. I am getting the following error:

我正在尝试在 Eclipse 开普勒中使用 Visual VM 调试 Java 应用程序。我正在执行具有选择 Visual VM 作为启动器的 main 方法的类。我已经按照http://blog.idrsolutions.com/2013/05/setting-up-visualvm-in-under-5-minutes 中给出的说明配置了 Visual VM 。我收到以下错误:

An internal error occurred during: “Launching TestNew”.
java.lang.NullPointerException

“TestNew” is the name of the class with main method I am trying to execute.

“TestNew”是我试图执行的带有 main 方法的类的名称。

please help.

请帮忙。

回答by Markus A.

I had the same issue... Let me expand a bit on Anushree's comment:

我有同样的问题......让我扩展一下 Anushree 的评论:

  • Go to WindowPreferencesRun/DebugLaunchingVisualVM Configuration
  • Browse...for the VisualVM Executablein your JDK's bin-directory
  • Make sure to also set the JDK's root directory under JDK Home. If you leave that pointing to your JRE directory, you'll run into the next error...
  • 转到窗口运行/调试启动VisualVM的配置
  • 在 JDK 的 bin 目录中浏览...以查找VisualVM Executable
  • 确保还在JDK Home下设置 JDK 的根目录。如果你把那个指向你的 JRE 目录,你会遇到下一个错误......

Happy profiling...

快乐的剖析...

BTW: If you then have issues getting your application to show up inside jVisualVM, take a look here: Getting Java program running in Eclipse to show up in VisualVM

顺便说一句:如果您在将应用程序显示在 jVisualVM 中时遇到问题,请查看此处: 让 Java 程序在 Eclipse 中运行以显示在 VisualVM 中