It seems to me it would be very useful to use Javascript for general server side scripting tasks as it has more or less the same features as Perl and Python. But AFAIK there are no generally available Javascript interpreters for the major machine architectures. I guess the other problem may be lack of libraries but surely these would come if the interpreters were there. Google's V8 maybe could be a starting point. Does anyone think we'll see this soon?
|
Node.js is exactly what you're asking for ... and more. In addition to being a JavaScript runtime it also provides APIs for common operations, such as file system access (JavaScript on the browser doesn't really need that) and network IO. It's marketed for building network application (and it's great at that!), but it's really a general purpose JavaScript runtime that you can use to build anything you want. Also, it is based on V8. |
|||||||||||||||||||||
|
There is a javascript interpreter written for Java apps (called Rhino) and it seems to be designed to write server code in javascript, but have it execute as java code. Personally, I think you're much better off with node.js as that is awesome. For a quick introduction, you can do much much worse than read the (free) NodeBeginner book. |
|||||||||
|
In addition to node.js, there is also gjs, which is a GNOME-oriented runtime giving access to GNOME, GTK, and GLib libraries, among others. I believe you can use with it any library that supports GObject introspection. Gjs is used widely in the GNOME3 desktop. |
|||
|
As mentioned by Joachim, node.js is exactly what you ask for. It appears to not be well known when compared with Python and especially Perl for this type of thing, but perhaps that is simply because JavaScript isn't widely considered to be very good. |
|||||||||||||||||||||
|
Windows Script Host has included a JScript (javascript) engine since at least Windows 2000 out of the box, allowing you to do sysadmin tasks using javascript. http://en.wikipedia.org/wiki/Windows_Script_Host It's also possible to embed this into a windows application using the WScript.Shell ActiveX/COM object. |
|||||||||
|