How to run JavaScript in the command-line environment

By: (plus.google.com) +David Herron; Date: June 15, 2018

Tags: Node.JS » JavaScript

JavaScript is an extremely popular programming language deserving of a bigger role than browser-based programming. Fortunately we can use JavaScript outside web browsers, because of several non-browser JavaScript implementations. The most popular, Node.js, is not the only choice for running JavaScript outside the web browser.

As I wrote in Node.JS Web Development - Fourth Edition -- Quit scratching your head already! Of course you're doing it, scratching your head and mumbling to yourself "What's a browser language doing on the server?"

JavaScript has had a long history in non-browser contexts. It was never a browser-only language, even though that has been its primary use for nearly the entire lifespan of the JavaScript language. JavaScript is a programming language, just like any other language, and the better question to as is: "Why should JavaScript remain trapped inside browsers?"

Node.js

(nodejs.org) https://nodejs.org

Obviously Node.js is a JavaScript platform that runs standalone. While its primary use is server-side applications, it can be used for command-line tools, GUI applications (using Electron), and much more.

Node.js is available for pretty much every computing platform from embedded linux boards up to massive mainframes. It is used for projects from little one-off scripts, to clouds of microservices, to massive systems.

RhinoJS

(developer.mozilla.org) https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino

Rhino is an open-source implementation of JavaScript written entirely in Java. It is typically embedded into Java applications to provide scripting to end users. It is embedded in Java 6 distribution as the default Java scripting engine. It was since dropped from the Java distribution in favor of another JavaScript implementation.

As a Java application it can run anywhere Java is available. That means pretty much every computing platform from embedded linux boards up to massive mainframes.

Nashorn

(openjdk.java.net) http://openjdk.java.net/projects/nashorn/

Nashorn replaced Rhino as the default JavaScript implementation for the Java platform. It uses newer JVM technologies than did Rhino, the MethodHandles and InvokeDynamic APIs described in JSR-292, and therefore has better performance.

Free standing JavaScript applications using the jrunscript command-line tool. (docs.oracle.com) https://docs.oracle.com/javase/7/docs/technotes/tools/share/jrunscript.html

RingoJS

(ringojs.org) https://ringojs.org/

Ringo is a JavaScript platform built on the JVM and optimized for server-side applications. It takes a non-dogmatic stance on things like I/O paradigms. Ringo ships with a large set of built-in modules and follows the CommonJS standard.

It is based on the Rhino engine. It includes a command-line tool, ringo for directly running JavaScript code.

As it uses CommonJS modules, along with the package.json file, it will be instantly familiar to Node.js programmers. However, it does not use Node.js modules.

Espruino

(www.espruino.com) https://www.espruino.com/

This is billed as "JavaScript for Microcontrollers". The boards are similar in scope to the Arduino, hence the name, with a JavaScript-based runtime.

Low.js - Neonius

(www.lowjs.org) http://www.lowjs.org/

(www.neonious.com) https://www.neonious.com/

Low.js is a fork of Node.js that runs on embedded microcontrollers. It uses Duktape as the JavaScript engine rather than V8.

Neonious is an embedded microcontroller with full Node.js API compatibility, supporting ES6 features, and can even use the TypeScript language.

Duktape

(www.duktape.org) http://www.duktape.org/

This is an embeddable JavaScript interpreter, that is used in Low.js. It can run on embedded devices as small as 160kB flash and 64kB system RAM. It supports Ecmascript E5/E5.1, with some semantics updated from ES2015+.

JerryScript

(jerryscript.net) http://jerryscript.net/

A JavaScript engine for Internet of Things. JerryScript is the lightweight JavaScript engine intended to run on a very constrained devices such as microcontrollers: a) Only few kilobytes of RAM available to the engine (<64 KB RAM) b) Constrained ROM space for the code of the engine (<200 KB ROM). The engine supports on-device compilation, execution and provides access to peripherals from JavaScript.

MuJS

(mujs.com) http://mujs.com/

MuJS is a lightweight Javascript interpreter designed for embedding in other software to extend them with scripting capabilities. MuJS was designed with a focus on small size, correctness, and simplicity. It is written in portable C and implements ECMAScript as specified by ECMA-262. The interface for binding with native code is designed to be as simple as possible to use, and is very similar to Lua. There is no need to interact with byzantine C++ template mechanisms, or worry about marking and unmarking garbage collection roots, or wrestle with obscure build systems.

Netscape's LiveWire server

This product included a JavaScript interpreter. Remember that when Netscape originally developed the JavaScript language, the original name was LiveScript. The language became known as JavaScript due to a marketing collaboration with Sun Microsystems where JavaScript was to be a kind of scripting language used with Java Applets in web pages. That went nowhere, but the name stuck.

The LiveWire server became later known as the Netscape Application Server, and is now known as the Oracle iPlanet Web Server.

See: (en.wikipedia.org) https://en.wikipedia.org/wiki/JavaScript#Server-side_JavaScript

Microsoft's ASP server -- Internet Information Server

This product included Microsoft's JScript interpreter. JScript was released in 1996, as a reverse-engineered JavaScript implementation. JScript appeared in Internet Explorer 3, and was used in the Internet Information Server. Today JavaScript capabilities are included in the .NET server-side platform.

Links

In addition to the above links:

(en.wikipedia.org) https://en.wikipedia.org/wiki/List_of_ECMAScript_engines

« Quickly start a new Electron software project Books and videos so you can easily learn Node.js programming »
2016 Election 2018 Elections Acer C720 Ad block Air Filters Air Quality Air Quality Monitoring AkashaCMS Amazon Amazon Kindle Amazon Web Services America Amiga and Jon Pertwee Android Anti-Fascism AntiVirus Software Apple Apple Hardware History Apple iPhone Apple iPhone Hardware April 1st Arduino ARM Compilation Artificial Intelligence Astronomy Astrophotography Asynchronous Programming Authoritarianism Automated Social Posting AWS DynamoDB AWS Lambda Ayo.JS Bells Law Big Brother Big Data Big Finish Big Science Bitcoin Mining Black Holes Blade Runner Blockchain Blogger Blogging Books Botnets Cassette Tapes Cellphones China China Manufacturing Christopher Eccleston Chrome Chrome Apps Chromebook Chromebox ChromeOS CIA CitiCards Citizen Journalism Civil Liberties Climate Change Clinton Cluster Computing Command Line Tools Comment Systems Computer Accessories Computer Hardware Computer Repair Computers Conservatives Cross Compilation Crouton Cryptocurrency Curiosity Rover Currencies Cyber Security Cybermen Cybersecurity Daleks Darth Vader Data backup Data Formats Data Storage Database Database Backup Databases David Tenant DDoS Botnet Department of Defense Department of Justice Detect Adblocker Developers Editors Digital Nomad Digital Photography Diskless Booting Disqus DIY DIY Repair DNP3 Do it yourself Docker Docker MAMP Docker Swarm Doctor Who Doctor Who Paradox Doctor Who Review Drobo Drupal Drupal Themes DVD E-Books E-Readers Early Computers eGPU Election Hacks Electric Bicycles Electric Vehicles Electron Eliminating Jobs for Human Emdebian Encabulators Energy Efficiency Enterprise Node EPUB ESP8266 Ethical Curation Eurovision Event Driven Asynchronous Express Face Recognition Facebook Fake News Fedora VirtualBox Fifth Doctor File transfer without iTunes FireFly Flash Flickr Fraud Freedom of Speech Front-end Development G Suite Gallifrey git Github GitKraken Gitlab GMAIL Google Google Chrome Google Gnome Google+ Government Spying Great Britain Green Transportation Hate Speech Heat Loss Hibernate High Technology Hoax Science Home Automation HTTP Security HTTPS Human ID I2C Protocol Image Analysis Image Conversion Image Processing ImageMagick In-memory Computing InfluxDB Infrared Thermometers Insulation Internet Internet Advertising Internet Law Internet of Things Internet Policy Internet Privacy iOS Devices iPad iPhone iPhone hacking Iron Man iShowU Audio Capture iTunes Janet Fielding Java JavaFX JavaScript JavaScript Injection JDBC John Simms Journalism Joyent Kaspersky Labs Kext Kindle Kindle Marketplace Large Hadron Collider Lets Encrypt LibreOffice Linux Linux Hints Linux Single Board Computers Logging Mac Mini Mac OS Mac OS X Machine Learning Machine Readable ID Macintosh macOS macOS High Sierra macOS Kext MacOS X setup Make Money Online March For Our Lives MariaDB Mars Mass Violence Matt Lucas MEADS Anti-Missile Mercurial MERN Stack Michele Gomez Micro Apartments Microsoft Military AI Military Hardware Minification Minimized CSS Minimized HTML Minimized JavaScript Missy Mobile Applications Mobile Computers MODBUS Mondas Monetary System MongoDB Mongoose Monty Python MQTT Music Player Music Streaming MySQL NanoPi Nardole NASA Net Neutrality Network Attached Storage Node Web Development Node.js Node.js Database Node.js Performance Node.js Testing Node.JS Web Development Node.x North Korea npm NVIDIA NY Times Online advertising Online Community Online Fraud Online Journalism Online Photography Online Video Open Media Vault Open Source Open Source and Patents Open Source Governance Open Source Licenses Open Source Software OpenAPI OpenJDK OpenVPN Palmtop PDA Patrick Troughton PayPal Paywalls Personal Flight Peter Capaldi Peter Davison Phishing Photography PHP Plex Plex Media Server Political Protest Politics Postal Service Power Control President Trump Privacy Production use Public Violence Raspberry Pi Raspberry Pi 3 Raspberry Pi Zero ReactJS Recaptcha Recycling Refurbished Computers Remote Desktop Removable Storage Republicans Retro Computing Retro-Technology Reviews RFID Rich Internet Applications Right to Repair River Song Robotics Robots Rocket Ships RSS News Readers rsync Russia Russia Troll Factory Russian Hacking Rust SCADA Scheme Science Fiction SD Cards Search Engine Ranking Season 1 Season 10 Season 11 Security Security Cameras Server-side JavaScript Serverless Framework Servers Shell Scripts Silence Simsimi Skype SmugMug Social Media Social Media Networks Social Media Warfare Social Network Management Social Networks Software Development Software Patents Space Flight Space Ship Reuse Space Ships SpaceX Spear Phishing Spring Spring Boot Spy Satellites SQLite3 SSD Drives SSD upgrade SSH SSH Key SSL Stand For Truth Strange Parts Swagger Synchronizing Files Tegan Jovanka Telescopes Terrorism The Cybermen The Daleks The Master Time-Series Database Tom Baker Torchwood Total Information Awareness Trump Trump Administration Trump Campaign Twitter Ubuntu Udemy UDOO US Department of Defense Virtual Private Networks VirtualBox VLC VNC VOIP Vue.js Walmart Weapons Systems Web Applications Web Developer Resources Web Development Web Development Tools Web Marketing Webpack Website Advertising Weeping Angels WhatsApp William Hartnell Window Insulation Windows Windows Alternatives Wordpress World Wide Web Yahoo YouTube YouTube Monetization