这是当NetBeans用户选择“附加调试器...”时出现的对话框。“调试”菜单中的项。

我想要预先设置Port字段的值,这样用户只需单击OK即可开始调试我的模块已启动的进程。
发布于 2011-11-15 13:05:04
要使用此技术,您的模块将需要对Debugger Core API的依赖,并且可以将以下内容添加到您的Installer中(在NetBeans 6.9.1上测试):
// get the _debugger_ properties
org.netbeans.api.debugger.Properties props =
Properties.getDefault().getProperties("debugger");
Map<String, Map<String, String>> toSave = new HashMap<String, Map<String, String>>();
Map<String, String> values = new HashMap<String, String>();
values.put("port", "123"); // <- this is what you're after
toSave.put("com.sun.jdi.SocketAttach", values);
props.setMap("connection_settings", toSave);作为参考,此设置位于:
~/.netbeans/6.9/config/Services/org-netbeans-modules-debugger-Settings.properties
在运行这段代码后,您将看到如下部分:
debugger.connection_settings:# java.util.HashMap
debugger.connection_settings.0-key:"com.sun.jdi.SocketAttach“
Debugger.connection_settings.0-值:# java.util.HashMap
debugger.connection_settings.0-value.0-key:"port“
debugger.connection_settings.0-value.0-value:"123“
debugger.connection_settings.0-value.length:1
debugger.connection_settings.length:1
https://stackoverflow.com/questions/4938008
复制相似问题