How to run a node.js application in Eclipse as an external tool

If you like using Eclipse as your preferred IDE for your coding, there is an easy way to use the built in External tools feature in Eclipse to launch Node.js applications, without having to install any external plugins.

Here is a short guide how.

The Hello World JavaScript project

Here is a simple overview of a typical Hello World application in JavaScript that prints out the phrase "Hello World" to the console.log.

Creating the External tool launcher

To launch this, we need to create a custom External tool launch configuration. Start by opening up your External tool configurations.

This can by done by going Run - External Tools - External Tools Configurations..., or by clicking on the External tools shortcut in the toolbar:

Select Program and then click on the New launch configuration button:

Once the configuration window opens, do the following:

  1. Select a name for your run configuration, for example "node.js - Hello World".
  2. Location should point towards node.js launch command, for Window-users this can point directly to node.exe.
  3. Working Directory should points towards your project. This can be done by clicking on the Browse Workspace... button.
  4. Enter the name of the JavaScript file you want node.js to execute. In my case it is "main.js".
  5. Apply and close the window.

Running your application

Your launch configuration is now ready to be called from the External tool button:

Running it will use the console view in Eclipse for the output:

Old comments from Disqus

Paul_Verest, Thursday, February 27, 2014 3:44 AM

It is nice DIY solution. Please be aware Nodeclipse Eclipse plugin http://www.nodeclipse.org/

Dennis, Friday, August 2, 2013 5:00 PM

Hi Christoffer,

I know this post is a year old now, but I found it very helpful. I was wondering, if you are familiar with doing custom run configurations for node frameworks that have their own way of launching the server. For example, I am using locomotivejs and the launch is thus: $ lcm server. I have been trying to configure eclipse to debug for locomotive but with no luck. Hoping you might be able to point me in the right direction.

Thank You.

Paul_Verest, Thursday, February 27, 2014 3:46 AM

I have not used lcm. If it Node.js script, it should be debuggable, however if you start debugging from the first line, you will need to step through all lcm code or set breakpoints