How to debug Graphhopper web server (in Jetty or Tomcat) with NetBeans?

I would like to run Graphhopper’s web server in the NetBeans IDE debugger. The Quick Start from Source Guide was a tremendous help. I’ve retrieved the master branch, I’ve run once and created the graph and tested with a browser the UI.

As that document says, I simply opened the project with NetBeans, no problem at all.

But I’m new to NetBeans, Is there a file or project I can simply “run” as-is to get it started? I haven’t found it yet :slight_smile:
Perhaps I need to configure the parameters I would like to pass along when starting the application, like the command line shell creates, to start the web server to host the web application when I click the run button in NetBeans…

I would prefer to actually run the web application as-is in the debugger. But if it would be better/simpler to simply create my own project that instantiates graphhopper’s GraphHopper and GHRequest classes, I’ll do that instead. I just am too new to this environment to know if it is easy to configure NetBeans to run the web server in the debugger or not…

Thanks for any helpful advice.

If you have it configured you just select the web project and press F6 to run it or Ctrl+F5 to debug it.

To configure the project right click the web project, then properties, then ‘run’, then select GHServer as main class and specify the necessary (command line) arguments like:

config=…/ datareader.file=your.pbf

and VM Options like:


Thank you, that was truly simple :slight_smile:
Very easy (once you know how)
When NetBeans opens the parent project the first time, it displays the included modules.
Double click the “GraphHopper Web” module (or right click and select to open the project)
Then the “GraphHopper Web” project will open and be displayed under "Parent Project"
Then right clicked this project, selected properties, and then the Run properties
I clicked the “Browse…” button to select the “Main Class”, the GHServer is the only one listed, I selected it.
I set the config and datareader.file parameters as you indicated, as well as the VM parameters.

Saved this, right clicked the project and selected Debug, and it works great! Time to go set some breakpoints…

1 Like