Special Agent Squeaky

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

Here is a quick guide on how to launch Node.JS applications inside Eclipse IDE without having to install any external plugins!
Please note that this blog post was published July 2012, so depending on when you read it certain parts of it might be out of date today. Unfortunately, I cannot constantly keep these blog posts always up to date to make sure the information is still accurate.
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.
Screenshot of a JavaScript file in Eclipse

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:
External tool configuration
Select "Program" and then click on the "New launch configuration" button:
New launch configuration
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.
Settings

Running your application

Your launch configuration is now ready to be called from the "External tool" button:
Launching the app
Running it will use the console view in Eclipse for the output:
Console
I just released a new gaming video on YouTube! Feel free to check it out!
ENGLISHESPAÑOLPORTUGUÊSDEUTSCHFRANÇAISITALIANOРУССКОМ日本한국인中国人
This website automatically uses Google Analytics for aggregated web analytics tracking which also creates browser cookies. If you do not wish to be tracked, please visit this site in incognito mode.