# Remote debugging in Netbeans

How to enable debuggning in netbeans on a remote server, to enable break points.

## The server

Enable remote debugging in Tomcat.  
Edit the service file

```bash
sudo nano /etc/systemd/system/tomcat[VERSION].service
```

Copy the "CATALINA\_OPTS" line and comment the old one out

Add the following add the end of the line (before the ending ping)

```
 -XX:+UseParallelGC -Xdebug -Xrunjdwp:transport=dt_socket,address=*:9999,server=y,suspend=n
```

Save and exit nano

Reload the service

```bash
sudo systemctl daemon-reload
```

Restart tomcat

```bash
ts restart-webserver
```

Ensure that a process now is listening on port 9999

```bash
ss -lntu
```

Open port 9999 in the firewall using the IaaS providers interface

## Netbeans

Ensure that you are running the same version of the software as the server, otherwise the break points wont make sense.

Attatch to the remote server

Select "Debug" and "Attach Debugger..."

[![image.png](https://docs.tsnocode.com/uploads/images/gallery/2025-09/scaled-1680-/hWaC0SZEb9LRiTfL-image.png)](https://docs.tsnocode.com/uploads/images/gallery/2025-09/hWaC0SZEb9LRiTfL-image.png)

Input the host and port 9999

[![image.png](https://docs.tsnocode.com/uploads/images/gallery/2025-09/scaled-1680-/kVvogGkyP27LKoJb-image.png)](https://docs.tsnocode.com/uploads/images/gallery/2025-09/kVvogGkyP27LKoJb-image.png)

Click OK

Find the "Debugger Console", normally in the bottom of the window, in the "Output" tab.

The console should read "User program running"

Try adding a break point and see if it works