如何从NetBeans远程调试jar [英] How to debug a jar remotely from netbeans

查看:62
本文介绍了如何从NetBeans远程调试jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图弄清楚如何调试远程运行的jar.这是我的情况:

I'm trying to figure out how to debug my jar that is running remotely. Here is my scenario:

  • 我的.jar将通过VPS运行.这个罐子基本上运行一个服务器游戏,因此它也连接到mysql db.我用3个.bat文件启动服务器,该文件看起来像这样:

  • My .jar will be running from a VPS. This jar basically runs a server for a game, so it also connects to a mysql db. I start the server with 3 .bat files that looks something like this:

设置CLASSPATH = .; dist \ aries.jar; dist \ mina-core.jar; dist \ slf4j-api.jar; dist \ slf4j-jdk14.jar; dist \ mysql-connector-java-bin.jar

set CLASSPATH=.;dist\aries.jar;dist\mina-core.jar;dist\slf4j-api.jar;dist\slf4j-jdk14.jar;dist\mysql-connector-java-bin.jar

java -Xmx500m -Dwzpath = wz \ -Djavax.net.ssl.keyStore = filename.keystore -Djavax.net.ssl.keyStorePassword = passwd -Djavax.net.ssl.trustStore = filename.keystore -Djavax.net.ssl.trustStorePassword = passwd net.world.WorldServer

java -Xmx500m -Dwzpath=wz\ -Djavax.net.ssl.keyStore=filename.keystore -Djavax.net.ssl.keyStorePassword=passwd -Djavax.net.ssl.trustStore=filename.keystore -Djavax.net.ssl.trustStorePassword=passwd net.world.WorldServer

暂停

我想要做的是像往常一样在vps上启动服务器,但是要通过Netbeans IDE在本地计算机上调试服务器.我不知道这是否可行,因为人们将连接到服务器(尽管我将调试仅使我在线的测试服务器).

What I want to do is start the server on the vps like normal, but debugging the server on my local machine via Netbeans IDE. I don't know if this is possible because people will be connecting to the server (although, I will be debugging a test server which will only have me online).

注意:在来到这里之前,我已经进行了很多搜索,并且发现很多与使用xdebug&php与我的情况没有多大关系(我不认为)

Note: I have done a lot of searching before coming here and a lot of what I found had to do with using xdebug & php which has doesn't have much to do with my situation (I don't think)

-谢谢

推荐答案

有一个 NetBeans FAQ页面关于这个.

简而言之:

将远程调试选项添加到Java命令.例如:

Add the remote debugging options to your Java command. For example:

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

然后,使用NetBeans中的Attach debugger选项并选择您的服务器和上面使用的端口(8888).就是这么简单.

Then, use the attach debugger option in NetBeans and select your server and the port you used above (8888). It's pretty much that easy.

您可能要考虑网络和防火墙注意事项,因为您可能已经注意到其中不涉及密码,因此任何可以连接到该端口的人都可以调试您的应用程序.这可能会带来很大的安全风险.您的VPS提供商可能有一些工具可以帮助您建立安全的私人连接.

You may want to think about network and firewall considerations, as you may have noticed there are no passwords involved, so anyone who can connect to the port can debug your app. This could be a big security risk. Your VPS provider probably has some tools to help with setting up a secure, private connection.

这篇关于如何从NetBeans远程调试jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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