Olga Olga - 5 months ago 9
Node.js Question

How can I run script.js in Eclipse console?

Answer

To set up Eclipse to run JavaScript files:

  1. In Eclipse, got to Run > External Tools > External Tool Configurations

  2. Double click on Program to open a new configuration and name your new configuration (ex. Node_Config)

  3. Figure out where you have node.js installed. Paste the results in the 'Location' box in Eclipse. (If you haven't installed node, do so here)

    1. Mac: in the command line, run which node.
    2. Windows: in the command line, run where node, or see this for more/different windows advice
  4. Fill in the following:

    1. Working Directory: ${container_loc}
    2. Arguments: ${resource_name}
  5. Click apply, and then close.

Now, in the main Eclipse screen, find the play button with a red toolbox (next to the regular play button). When you have a js file open that you want to run, click this and it will be just like running it from your console using node.

Comments