java remote debugging
Some times, in java world (and others ), the only fast debugging for weird bugs, is using a Remote Debugging directly to the process (in other environment).
That is possible using the argument “-Xdebug” in our “java -jar … ” call, two interesting flags are “address” and “suspend“, the first “address” allow us to expose the tcp port for the connection, if you use 0, you will have a random port. The other “suspend“, “yes” allow us to wait the process for a connection of debugging and “no” no xD.
Example
# Add the argument to the call java process java -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y -jar myFavoriteJavaAppsxD.java
and our ide (in this case Eclipse), follows the next steps
Tips
If you don’t have direct connection to the tcp port but yes to one ssh port, one option is use a ssh tunnel
# Connect to the server myserver with a ssh local tunnel, in your local environment the port TCP 8000 will be redirect the traffic to the port 8000 on the server. ssh -L 0:8000:0:8000 user@myserver
Happy debugging and sorry for grammatical english issue’s xD.