无 Main 方法的 Java 远程调试
我正在用 Java 为销售点系统开发扩展类。 POS 软件调用我的 Java 类,因此我编写的代码没有 main 方法。另外,POS 软件必须在另一个状态的远程 PC 上运行,但我有完全访问权限。
如何设置 Eclipse 以使用运行 POS 软件的远程 PC 来运行和调试我的 Java 代码?我在 Eclipse 设置中摸索并做了一些谷歌搜索,但我仍然不确定这是否可能。
使用 Eclipse Helios,编写目标版本为 115 的 Java 代码,但大多数 POS 系统至少运行 1.5x。
谢谢。
I am developing extension classes in Java for a point of sale system. The POS software calls my Java class, so the code I am writing has no main method. Also, the POS software has to be run on a remote PC in another state, but I have full access to it.
How can I set up Eclipse to both run and debug my Java code using the remote PC running the POS software? I poked around in the Eclipse settings and did some googleing, but I am still unsure if this is even possible.
Using Eclipse Helios, writing Java code with target version 115 but most of the POS systems are running at least 1.5x.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将类似于以下内容的内容添加到远程进程(POS 软件)的 JVM 参数中:
这将启用端口 8000 上的远程调试。要通过 Eclipse 连接到此进程,请选择
Run
菜单,然后选择 <代码>调试配置...。在左侧窗格中,选择远程 Java 应用程序
,然后单击列表上方的新启动配置
按钮。需要注意的重要设置是Host
和Port
字段。主机值必须与远程进程的主机名匹配,并且端口应与您在 JVM 设置中配置的端口匹配。您可能还需要在Source
选项卡上添加条目,以确保所有源代码都可供单步执行。Add something similar to the following to the JVM arguments for the remote process (the POS software):
This enables remote debugging on port 8000. To connect to this process via Eclipse, select the
Run
menu and chooseDebug Configurations...
. In the pane on the left, chooseRemote Java Application
and click theNew launch configuration
button above the list. The important settings to note are theHost
andPort
fields. The host value must match the hostname of the remote process, and the port should match what you configured in the JVM settings. You also might need to add entries on theSource
tab to ensure that all of the source code is available to step through.我认为如果不为 POS 编写模块,就无法远程调试 POS。
另外,我不知道您的应用程序是什么,但是像这样的自动测试与自动夜间构建一样好,它们不足以用于认证或最终用户测试。
有些 POS 为您的型号提供“他们的仿真”工具,如果您有这些工具,您可以使用它。
但最后,您应该只实现一个 JUnit(包含在 Eclipse 中)或构建一个 main 方法来执行第一级测试。这将消除一些测试,但最后,您需要手动使用 POS 进行测试。
I don't think you can remote-debugging POS without coding a module for the POS.
Also I don't know what is your application, but automatic test like this are just good as automatic nightly build, they aren't good enough for certification or end-user test.
Some POS give "thier emulation" tool for your model, if you have those, you could use it.
But at the end, you should just implement a JUnit (included in Eclipse) or build a main method for doing your first level of test. This will eliminate some tests but at the end, you'll need to test with the POS manually.