How to run .js file in Eclipse IDE for JavaScript Webdeveloper?

8,806

Well I would say that Eclipse is a poor tool for JavaScript development but then I don't like Eclipse nor Java.

Opinions aside, you need to remember that JavaScript was designed as a scripting tool to be embedded in other environments, primarily in web pages.

So to do what you want, you need to create an HTML page with the JavaScript file referenced as a script.

The alternative approach is to use Node.JS to host your JavaScript instead of a browser. You can use the Nodeclipse project for this.

If you are not wedded to Eclipse, there are plenty of other options. My current choice is Adobe's Brackets. This is an editor rather than a full IDE however but it is built around Node.JS so you can run JavaScript from within the editor.

Share:
8,806

Related videos on Youtube

Chris Aung
Author by

Chris Aung

Student

Updated on September 18, 2022

Comments

  • Chris Aung
    Chris Aung over 1 year

    I am learning JavaScript at the moment and have just installed the Eclipse IDE for JavaScript Web Developers. I have created a new project and created a new file with an extension of .js.

    I have another Eclipse version which I purely use it for Python and normally, when I run the script, I am able to see the output in the console right away. But this is not the case here as whenever I try to run the following script,

    var myfruits = [ 'apple', 'orange', 'mango'];
    console.log(myfruits);
    

    I end up with this Unable to Launch message: enter image description here

    What am I missing?