I'm writing a telegram bot in Java. This bot will be hosted on Heroku in future. For now I'm just building it with Gradle and run it locally with:
heroku local web
command. Is there any way to debug it using Intellij IDEA?
Yes, running heroku local starts a normal Java process under the hood. You can confirm this by running jps (unsure if that works on Windows).
In order to debug with Intellij, you'll need to provide to proper JVM options to enable debugging. For example:
-Xdebug -Xrunjdwp:transport=dt_socket,address=9090,server=y,suspend=n
You can put these in your Procfile or set them as JAVA_OPTS and reference that env var in your Procfile.
Once the heroku local process is started, you can confirm it's working by running:
jdb -attach localhost:9090
Then you can connect a remote debugger in Intellij on localhost:9090.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With