I just moved from Netbeans to Eclipse. In Netbeans, I can debug Playframework applications out of the box. However, in Eclipse, it seems hard to configure this in order to debug a web app (a Playframework app in specific).
As in Play! documentation,
The main launcher in only usable with the Run As eclipse command. You can then use the “Connect JPDA launcher” using “Debug As” to start a debugging session at any time. Stopping the debugging session will not stop the server.
However, I can not see “Connect JPDA launcher” in "Debug As" (I'm using Eclipse Classic 3.7.0). I've searched about JPDA (I'm new to Java and don't know about "main launcher" and JPDA, then config Remote Debug as instruct in http://javarevisited.blogspot.com/2011/02/how-to-setup-remote-debugging-in.html But it's returning an error:
Failed to connect to remote VM. Connection refused. Connection refused: connect
I've searched and found some suggestions like:
1.)editing catalina.bat and adding the lines : set JPDA_TRANSPORT=dt_socket ... set JPDA_ADDRESS=8000 AND 2.)Editing startup.bat call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
Actually I don't clearly understand this and I guess it's for configuring Tomcat. However, I'm using Play! default server, checked the application.conf and sure that it's listening to port 9000 and 8000 for JPDA.
Of course, I have started the Play app before debugging, I can access the app via port 9000 normally. I'm using Win 7 with no admin rights.
Do you have a detailed guide on debugging Play! in Eclipse?
To put breakpoints in your code, double click in the left margin on the line you want execution to stop on. You may alternatively put your cursor in this line and then press Shift + Ctrl + B . To control execution use the Step Into, Step Over and Step Return buttons. They have the shortcuts F5 , F6 and F7 respectively.
First, we need to start the Java program within Eclipse in debug mode. This can be achieved in two ways: Right-click on the editor and select Debug As -> Java Application (shown in below screenshot) Debug the program from the toolbar (highlighted in below screenshot)
As of Play 2.0, the eclipse
folder and launchers are no longer generated when you run play eclipsify
. After running play eclipsify
, you can debug your project in Eclipse as follows:
play debug run
.Debug As -> Debug Configurations...
Remote Java Application
, then click New
.localhost
. Set the port to 9999
(the default port used by the play debug run
command).Apply
to save, then Debug
to connect to your running Play instance.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