Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I run script.js in Eclipse console?

Is it possible to do the same as this in Eclipse what he is doing in Intellij IDEA? to run the javascript file in console?

like image 385
Olga Avatar asked Dec 15 '22 05:12

Olga


1 Answers

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.

like image 156
ebbishop Avatar answered Dec 26 '22 18:12

ebbishop