1 2 Previous Next 17 Replies Latest reply on May 13, 2015 6:08 AM by maxandersen

    JavaScript debugging

    hwellmann.de

      With all the hybrid application development support in JBoss Tools, I may be missing something obvious, but I wonder how to debug JavaScript in Eclipse?

       

      I'm thinking of something like

       

      • Set a breakpoint in a JavaScript editor view
      • Open an HTML page via LiveReload in a browser, or use some browser-aware Debug launcher
      • Click on some widgets in the browser to trigger the JavaScript function with the breakpoint
      • See the breakpoint being hit in Eclipse, inspect call stack and variables.

       

      Is that possible at all (maybe using some extra plugins not included in JBoss Tools)?

       

      Best regards,

      Harald

        • 1. Re: JavaScript debugging
          slayercode2
          • 2. Re: JavaScript debugging
            hwellmann.de

            Yes, I know these links. Did you try to debug a web application with any of the suggested methods?

             

            Most of your links are way too old. Chrome dev tools are dead. VJET is practically dead since 2013. I managed to debug some JavaScript code running on node.js with Nodeclipse, but I don't see how to do it in the browser, and Nodeclipse documentation is not very helpful.

            • 3. Re: JavaScript debugging
              slayercode2

              Nope, I hadn't.

              I use actually Firebug to debug JavaScript.

              It seems that Firebug can be used to debug JavaScript in Eclipse: https://www.youtube.com/watch?v=uvzqMmMDzUE. JSDT is another eclipse-based debuger but it uses Chrome dev tools in its implementation (http://www.eclipse.org/webtools/jsdt/debug/).

              • 4. Re: JavaScript debugging
                ibuziuk

                Hey, Harald.

                Assuming that you are interested in hybrid app development, you could use CordovaSim for livereload / debugging stuff

                Please, have a look at my blog - JBoss Tools - Brand new BrowserSim / CordovaSim features

                The blog contains a short demo video that covers js debugging, eclipse console logging and livereload.

                • 5. Re: JavaScript debugging
                  hwellmann.de

                  Hi Ilya,

                   

                  all I can see in your blog about debugging is a screenshot of the Chrome debugger. It's not that I don't know how to debug JavaScript with Firebug or Chrome, the question is how to debug JavaScript inside Eclipse.

                   

                  I don't normally use NetBeans, but I had JavaScript debugging up and running in NetBeans in 5 minutes, with the NetBeans Chrome extension.

                   

                  It seems the bottom line is that Eclipse does not have an up-to-date supported solution for JavaScript debugging. Does that mean that everybody doing mixed Java/JavaScript development has already dropped Eclipse for NetBeans or IntelliJ?

                  • 6. Re: JavaScript debugging
                    hwellmann.de

                    Crossfire has not been updated for two years. Does it work with recent Firefox versions? I don't even see how to start the Crossfire server in Firefox/Firebug. The button for that is supposed to be on status bar, but Firefox no longer has a status bar.

                    • 7. Re: JavaScript debugging
                      ibuziuk

                      Hey, Harald

                      < all I can see in your blog about debugging is a screenshot of the Chrome debugger

                      The blog also contains demo video. Here is the direct link - https://vimeo.com/109909395

                      However, I guess this is not you are interested in, cause one won't be able to debug js inside eclipse editor via BrowserSim / CordovaSim anyways.

                      • 8. Re: JavaScript debugging
                        dgolovin

                        Chrome dev tools project is abandoned and 'is no longer actively maintained' but not dead. Last time I had it installed in luna and mars M5 and was able to attach to running pages and do basic debugging like install breakpoints, suspend/execute JavaScript on page, see local/global variables . It is not really user friendly, but it still works in some way. I was following this page https://code.google.com/p/chromedevtools/wiki/EclipseDebugger in my tests.

                        • 9. Re: JavaScript debugging
                          maxandersen

                          It means we are looking for someone to help enable smoother javascript debugging.

                          • 10. Re: JavaScript debugging
                            maxandersen

                            btw. main feedback we've gotten is that they prefer using the debugger tools for javascript in the browser rather than in the IDE hence we've focused more on editing of html/source than on debugging for now.

                            • 11. Re: JavaScript debugging
                              hwellmann.de

                              Max Rydahl Andersen schrieb:

                               

                              btw. main feedback we've gotten is that they prefer using the debugger tools for javascript in the browser rather than in the IDE hence we've focused more on editing of html/source than on debugging for now.

                              There's nothing wrong with that. On the other hand, with Nashorn in Java 8, there are a lot of new possibilities for server-side JavaScript.

                               

                              In NetBeans, you can debug a Java class invoking a Nashorn script invoking another Java class, stepping from Java into JavaScript and back into Java with full call stack and variable display. That's pretty impressive, and I'm just wondering why Eclipse is lagging behind.

                               

                              I started this thread here (and similar ones in other places) just to check out all the candidates like Eclipse Platform/JSDT, JBoss Tools, Nodeclipse and to make sure I wasn't missing anything not so obvious.

                               

                              Any suggestion for a better forum to address this topic to a wider community of Eclipse users would be very welcome.

                              • 12. Re: JavaScript debugging
                                maxandersen

                                oh - i'm very aware and interested in utilizing nashorn etc. for better execution and debugging.

                                 

                                The reason why Eclipse is lacking behind is that the whole team that did JSDT from IBM moved off Eclipse and started other things, one is their Orion project.

                                 

                                We (Red Hat) now is lead of JSDT (via Victor Rubezhny) but that is just one person for now so he/we been cleaning up more grave bugs/issues for a while now. Working our way through things like false validations, memory issues and just general base issues.

                                 

                                For things like debugging and extra new features we are definitely looking for contributions.

                                 

                                Wether you do that conversation here or join the wtp-dev mailing list is up to you. In both cases we'll be listening and help where we can if someone wants to explore/contribute.

                                • 13. Re: JavaScript debugging
                                  hwellmann.de

                                  Interesting - I didn't know that Red Hat had taken over JSDT. The Eclipse project page only mentions IBM contacts.  Orion - well, I don't think the world has been waiting for a mutilated IDE running in the browser...

                                   

                                  It's sad to see that Eclipse seems to be losing both corporate and community support, and regarding the latter, IMHO Eclipse Foundation is doing their best to scare off potential contributors by their ridiculous amount of paperwork and process guidelines. In the age of GitHub, a pull request should be sufficient to make a contribution.

                                   

                                  Anyway, I've been exploring Nashorn debugging a bit, working directly with JDI and Nashorn DebuggerSupport. Now the next question is how this fits into the big picture of JSDT and JDT. I'll start a new thread on the wtp-dev mailing list.

                                   

                                  Thanks,

                                  Harald

                                  • 14. Re: JavaScript debugging
                                    maxandersen

                                    Ah, we'll get the project page updated.

                                     

                                    I'm not sure what paperwork you consider ridiculous - its a click of a button on "I'm allowed to contribute this". If you see it as more complicated let me know.

                                     

                                    I agree GitHub PR's are easier, but with Gerrit enabled on JSDT things should be easier.

                                     

                                    I saw your mail on wtp-dev and i'll follow up there.

                                    1 2 Previous Next