I used Aptana Studio 3 for Python, and when I hit the "Run", the results are shown in the the console. However, when I created js file and then hit "Run", it opens up my firefox browser and show the codes there, not even the results. Why is that?
Asked
Active
Viewed 1,572 times
0
-
Because that's the typical JavaScript developer requirements - to see how their code works in a browser. Try that with a .html file. (Better editors do a better job at this, and Aptana can too). – Benjamin Gruenbaum Dec 29 '13 at 09:13
-
So if I type `alert ("hello world")` in a js file, I won't be able to see the output of `hello world` in the console? Sorry newbie here :P – PMa Dec 29 '13 at 09:15
-
`alert` is not a part of JavaScript but rather a part of an API that glues JavaScript to the browser. In serverside JavaScript ( NodeJS for example) `alert` does not even exist. – Benjamin Gruenbaum Dec 29 '13 at 09:20
1 Answers
0
It seems impossible according to this thread. However, you can use node.js. Simply call node myFile.js
to run it (after installation). Another solution is embedding scripts in an html file.
Well, for node.js :
Go on their site : http://nodejs.org, and download it. After that, reboot and in eclipse, select Run > External Tools... > External Configuration.
Then put :
Location : node
Working directory: ${container_loc}
Arguments: ${resource_loc}
See this thread : Custom command for Eclipse on current file. Also note that the command
alert
does not work since it is cli.
-
Thanks, I tried with embedding the script in html and it worked. I will check out node.js as well. – PMa Dec 29 '13 at 19:11