Java 如何运行 VisualVM Eclipse 插件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16587711/
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-08-16 12:19:33  来源:igfitidea点击:

How to run VisualVM Eclipse Plugin

javaeclipsevisualvm

提问by Himanshu Yadav

I am trying to run Visual Plugin in Eclipse Juno. Visual VM usage instructions are confusing. Running my application on Tomcat server and I have no idea how to point it to Visual VM.
Usage Instructions:

我正在尝试在 Eclipse Juno 中运行 Visual Plugin。Visual VM 使用说明令人困惑。在 Tomcat 服务器上运行我的应用程序,但我不知道如何将它指向 Visual VM。
使用说明:

  1. Create a new application configuration
  2. Choose the "VisualVM Launcher" as the application launcher
  3. Run/Debug the application with the created configuration to have VisualVM started automatically.
  1. 创建新的应用程序配置
  2. 选择“VisualVM Launcher”作为应用程序启动器
  3. 使用创建的配置运行/调试应用程序以自动启动 VisualVM。

How would I choose Visual VM Launcher for my application which is running on Tomcat?

我将如何为在 Tomcat 上运行的应用程序选择 Visual VM Launcher?

采纳答案by Aaron Digulla

The VisualVM plugin for Eclipseis only useful when you can start the application from within Eclipse (i.e. when it's a plain Java application, not Tomcat or something that is to be deployed in Tomcat).

EclipseVisualVM 插件仅在您可以从 Eclipse 中启动应用程序时(即,当它是一个普通的 Java 应用程序,而不是 Tomcat 或要部署在 Tomcat 中的东西时)才有用。

In your case, just start jvisualvm(which you can find the same folder as javac) and select the Tomcat process in the dialog.

在您的情况下,只需启动jvisualvm(您可以找到与 相同的文件夹javac)并在对话框中选择 Tomcat 进程。

Note that you may have to configure Tomcat to allow VisualVM to connect.

请注意,您可能必须配置 Tomcat 以允许 VisualVM 连接

Alternatively, you can create a launch config for Tomcat but to do this, you will have to read the startup files, collect all JARs that have to go into the classpath manually andcorrectly, collect startup parameters, use the correct "current directory", set a couple of system properties ... it's possible but you probably don't want to try.

或者,您可以创建为Tomcat的启动配置,但要做到这一点,你将不得不读取启动文件,收集需要手动进入classpath中所有的JAR正确,收集启动参数,使用正确的“当前目录”,设置几个系统属性......这是可能的,但你可能不想尝试。