远程调试作为 Windows 服务启动的 Java 应用程序 [英] Remote debugging of a Java application launched as a Windows service

查看:88
本文介绍了远程调试作为 Windows 服务启动的 Java 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 Java 应用程序是通过 java.dll 从本机程序中启动的.此本机程序在 Windows 上作为服务启动.

My Java application is started from within a native program through java.dll. This native program is launched as a service on Windows.

JVM 参数中添加了以下选项用于远程调试:

The following options have been added to the JVM args for remote debugging:

-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n

在此配置中,无法从例如连接我的 Eclipse 工作区.如果程序是从命令行启动的,即不是作为服务启动,我可以连接到端口 8787.

In this configuration, it is impossible to connect from e.g. my Eclipse workspace. If the program is launched from the command-line, i.e. not as a service, I can connect to port 8787.

如何允许远程调试连接到此服务?

How can I allow remote debugging connections to this service?

推荐答案

无论是作为服务运行还是从命令行运行都没有区别.

There's no difference if it runs as a service or from command line.

请仔细检查 java.exe 在作为服务启动时是否收到这些命令行参数.

Please double-check that java.exe receives those command line params when started as service.

这篇关于远程调试作为 Windows 服务启动的 Java 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆