Node.js helloworld example in Eclipse & Command Prompt in windows.

In this tutorial, let us see how to create & run hello world node application in command prompt and eclipse ide. Also we will see how to install & setup node.js in windows os. Node.js a JavaScript runtime built on Chrome’s V8 JavaScript engine allows you to develop server side applications using javascript. It has many inbuilt libraries which eases writing of server side applications. For eg. you can create an application which serves as a web server with 5 lines of code. Usually Javascript code is executed by client browser. But in Node.js, javascript code is executed by node.js engine installed at server which  provides an event-driven architecture.

Now let us see how to install node.js.
Download node.js for windows at

Run the exe file which will install the node.js which comes with npm (node package manager) 

Now You should be able to run both node and npm  commands on command prompt

Suppose node.js installed on C:\Program Files\nodejs

then npm will be located on C:\Program Files\nodejs\node_modules\npm\bin

note : nodejs should be in windows path. You can check it with path command.

Test both npm and node installation by entering the commands at command prompt as given below


Usage: npm <command>

where <command> is one of:
access, add-user, adduser,…



Now you will be able to run any node application.

Now let us create and run a node application using command prompt

Node Application in Command Prompt

Make a folder

c:\>mkdir node_example

c:\node_example>create a text file and write the below code

console.log("Hi Welcome to Node.js  Hello World");
var d = new Date();
console.log("Current Date is: " + ("0" + (d.getDate() + 1)).slice(-2)+"/"+("0" + (d.getMonth() + 1)).slice(-2)+"/"+d.getFullYear());
console.log("Current Time is: "+ d.getHours() + ":" + d.getMinutes() + ":"  + d.getSeconds());

and save it as helloworld.js

Now run the node application by running the below command on command prompt

c:\node_example>node helloworld.js

nodejs helloworld command prompt

Now let us see How to create node.js application in Eclipse
Node Application in Eclipse

Before creating a node.js project, we need to install nodeclipse plugin for eclipse so that we can develop and run node.js application in eclipse ide.

To install nodeclipse plugin, follow the below steps

Open Eclipse and  access  the menu Help->Eclipse Marketplace

Eclipse nodeclipse

type nodeclipse in the  find box and search which will list the nodeclipse, the eclipse plugin for Node.js

Now select install and restart eclipse after the installation is complete.

At  command prompt, run the below command

C:\node_example>npm install -g nodeclipse

Output of the above command:

C:\Users\vkj\AppData\Roaming\npm\epm -> C:\Users\vkj\AppData\Roaming\npm\node_modules\nodeclipse\bin\epm.js
C:\Users\vkj\AppData\Roaming\npm\nodeclipse -> C:\Users\vkj\AppData\Roaming\npm\node_modules\nodeclipse\bin\nodeclipse.js
C:\Users\vkj\AppData\Roaming\npm\nci -> C:\Users\vkj\AppData\Roaming\npm\node_modules\nodeclipse\bin\nci.js
nodeclipse@0.17.2 C:\Users\vkj\AppData\Roaming\npm\node_modules\nodeclipse
├── shelljs@0.2.6
└── optimist@0.6.1 (wordwrap@0.0.3, minimist@0.0.10)

Now plugin installation is complete.

To create  node  project in eclipse, create a folder (for eg. node_example) where you want to create node application and type the below command on the command prompt

C:\node_example>nodeclipse -p

Now Add the above project in Eclipse

File -> Import… -> General / Existing Projects into Workspace
and enter project directory: C:\node_example

node helloworld eclipsenode helloworld eclipse1 node helloworld eclipse2

Click on finish

Project Structure

node eclipse project structure
Now Run the node application by right clicking  on the helloworld.js file and selecting  Run on Server->Node Application


node helloworld eclipse3

node app eclipse output




2.  node.js

Leave a Reply