diff --git a/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/jtreg/ActionProviderImpl.java b/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/jtreg/ActionProviderImpl.java
index 074325347db5..a4bf4cd9b5f3 100644
--- a/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/jtreg/ActionProviderImpl.java
+++ b/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/jtreg/ActionProviderImpl.java
@@ -299,7 +299,8 @@ public String[] getExtraMakeTargets() {
case COMMAND_RUN_SINGLE: break;
case COMMAND_DEBUG_TEST_SINGLE:
try {
- InetAddress addr = InetAddress.getLocalHost();
+ String userSelectedAddress = settings != null ? settings.getDebugListenAddress() : null;
+ InetAddress addr = userSelectedAddress == null || userSelectedAddress.isBlank() ? InetAddress.getLoopbackAddress() : InetAddress.getByName(userSelectedAddress);
debugSocket[0] = new ServerSocket(0, 1, addr);
BACKGROUND.post(() -> {
try {
diff --git a/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/project/Settings.java b/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/project/Settings.java
index a0d56e7c75cc..f0e8474e3f7e 100644
--- a/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/project/Settings.java
+++ b/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/project/Settings.java
@@ -36,6 +36,7 @@ public class Settings {
private static final String KEY_TEST_USE_IMAGE = "test-use-image";
private static final String KEY_USE_ANT_BUILD = "use-langtools-ant-build";
private static final String KEY_ANT_BUILD_LOCATION = "langtools-ant-build-location";
+ private static final String KEY_DEBUG_LISTEN_ADDRESS = "debug-listen-address";
private static final String DEF_ANT_BUILD_LOCATION = "make/ide/netbeans/langtools/build.xml";
@@ -93,6 +94,14 @@ public void setAntBuildLocation(String antBuildLocation) {
getPrivatePreferences().put(KEY_ANT_BUILD_LOCATION, antBuildLocation);
}
+ public String getDebugListenAddress() {
+ return getPrivatePreferences().get(KEY_DEBUG_LISTEN_ADDRESS, null);
+ }
+
+ public void setDebugListenAddress(String jtregLocation) {
+ getPrivatePreferences().put(KEY_DEBUG_LISTEN_ADDRESS, jtregLocation);
+ }
+
public void flush() {
try {
getPrivatePreferences().flush();
diff --git a/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/project/customizer/BuildCategory.form b/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/project/customizer/BuildCategory.form
index 956059918b72..1aa6ae7a7f15 100644
--- a/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/project/customizer/BuildCategory.form
+++ b/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/project/customizer/BuildCategory.form
@@ -38,13 +38,25 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -60,7 +72,14 @@
-
+
+
+
+
+
+
+
+
@@ -90,5 +109,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/project/customizer/BuildCategory.java b/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/project/customizer/BuildCategory.java
index 31a69880750b..3db406f25f70 100644
--- a/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/project/customizer/BuildCategory.java
+++ b/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/project/customizer/BuildCategory.java
@@ -33,10 +33,11 @@ public class BuildCategory extends javax.swing.JPanel {
/**
* Creates new form BuildCategory
*/
- public BuildCategory(boolean useAntBuild, String antBuildLocation) {
+ public BuildCategory(boolean useAntBuild, String antBuildLocation, String debugListenAddress) {
initComponents();
this.useAntBuild.setSelected(useAntBuild);
this.antBuildLocation.setText(antBuildLocation);
+ this.debugListenAddress.setText(debugListenAddress);
updateEnableDisable();
}
@@ -56,6 +57,9 @@ private void initComponents() {
useAntBuild = new javax.swing.JCheckBox();
antBuildLocationLabel = new javax.swing.JLabel();
antBuildLocation = new javax.swing.JTextField();
+ jLabel1 = new javax.swing.JLabel();
+ debugListenAddress = new javax.swing.JTextField();
+ jLabel2 = new javax.swing.JLabel();
org.openide.awt.Mnemonics.setLocalizedText(useAntBuild, org.openide.util.NbBundle.getMessage(BuildCategory.class, "BuildCategory.useAntBuild.text")); // NOI18N
useAntBuild.addActionListener(new java.awt.event.ActionListener() {
@@ -68,6 +72,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
antBuildLocation.setText(org.openide.util.NbBundle.getMessage(BuildCategory.class, "BuildCategory.antBuildLocation.text")); // NOI18N
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(BuildCategory.class, "BuildCategory.jLabel1.text")); // NOI18N
+
+ debugListenAddress.setText(org.openide.util.NbBundle.getMessage(BuildCategory.class, "BuildCategory.debugListenAddress.text")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(BuildCategory.class, "BuildCategory.jLabel2.text")); // NOI18N
+
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@@ -75,12 +85,20 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(useAntBuild, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
- .addGap(21, 21, 21)
- .addComponent(antBuildLocationLabel)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(antBuildLocation))
- .addComponent(useAntBuild, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE))
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGap(21, 21, 21)
+ .addComponent(antBuildLocationLabel))
+ .addComponent(jLabel1))
+ .addGap(27, 27, 27)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jLabel2)
+ .addGap(0, 0, Short.MAX_VALUE))
+ .addComponent(antBuildLocation)
+ .addComponent(debugListenAddress))))
.addContainerGap())
);
layout.setVerticalGroup(
@@ -92,7 +110,13 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(antBuildLocationLabel)
.addComponent(antBuildLocation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addContainerGap(244, Short.MAX_VALUE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel1)
+ .addComponent(debugListenAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jLabel2)
+ .addContainerGap(186, Short.MAX_VALUE))
);
}// //GEN-END:initComponents
@@ -104,6 +128,9 @@ private void useAntBuildActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField antBuildLocation;
private javax.swing.JLabel antBuildLocationLabel;
+ private javax.swing.JTextField debugListenAddress;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
private javax.swing.JCheckBox useAntBuild;
// End of variables declaration//GEN-END:variables
@@ -119,10 +146,11 @@ public ProjectCustomizer.Category createCategory(Lookup context) {
@Override
public JComponent createComponent(ProjectCustomizer.Category category, Lookup context) {
Settings settings = context.lookup(Settings.class);
- BuildCategory panel = new BuildCategory(settings.isUseAntBuild(), settings.getAntBuildLocation());
+ BuildCategory panel = new BuildCategory(settings.isUseAntBuild(), settings.getAntBuildLocation(), settings.getDebugListenAddress());
category.setOkButtonListener(evt -> {
settings.setUseAntBuild(panel.useAntBuild.isSelected());
settings.setAntBuildLocation(panel.antBuildLocation.getText());
+ settings.setDebugListenAddress(panel.debugListenAddress.getText());
});
category.setStoreListener(evt -> settings.flush());
return panel;
diff --git a/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/project/customizer/Bundle.properties b/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/project/customizer/Bundle.properties
index 5884a2c4060e..997e693b9eb4 100644
--- a/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/project/customizer/Bundle.properties
+++ b/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/project/customizer/Bundle.properties
@@ -23,3 +23,6 @@ BuildCategory.antBuildLocation.text=
BuildCategory.useAntBuild.text=Use ant build for langtools
BuildCategory.antBuildLocationLabel.text=Ant build location:
TestCategory.useFullImage.text=Use full JDK image to run tests
+BuildCategory.jLabel1.text=Debug Listened Address:
+BuildCategory.jLabel2.text=Leave empty for default
+BuildCategory.debugListenAddress.text=