HOME

TheInfoList



OR:

Rhino is a JavaScript engine written fully in Java and managed by the Mozilla Foundation as open source software. It is separate from the SpiderMonkey engine, which is also developed by Mozilla, but written in C++ and used in
Mozilla Firefox Mozilla Firefox, or simply Firefox, is a free and open-source web browser developed by the Mozilla Foundation and its subsidiary, the Mozilla Corporation. It uses the Gecko rendering engine to display web pages, which implements current and a ...
.


History

The Rhino project was started at
Netscape Netscape Communications Corporation (originally Mosaic Communications Corporation) was an American independent computer services company with headquarters in Mountain View, California and then Dulles, Virginia. Its Netscape web browser was onc ...
in 1997. At the time, Netscape was planning to produce a version of Netscape Navigator written fully in Java and so it needed an implementation of JavaScript written in Java. When Netscape stopped work on ''Javagator'', as it was called, the Rhino project was finished as a JavaScript engine. Since then, a couple of major companies (including
Sun Microsystems Sun Microsystems, Inc. (Sun for short) was an American technology company that sold computers, computer components, software, and information technology services and created the Java programming language, the Solaris operating system, ZFS, the ...
) have licensed Rhino for use in their products and paid Netscape to do so, allowing work to continue on it. Originally, Rhino compiled all JavaScript code to Java bytecode in generated
Java class file A Java class file is a file (with the filename extension A filename extension, file name extension or file extension is a suffix to the name of a computer file (e.g., .txt, .docx, .md). The extension indicates a characteristic of the file cont ...
s. This produced the best performance, often beating the C++ implementation of JavaScript run with just-in-time compilation (JIT), but suffered from two faults. First, compiling time was long since generating bytecode and loading the generated classes was a resource-intensive process. Also, the implementation effectively leaked memory since most
Java virtual machine A Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode. The JVM is detailed by a specification that formally describes ...
s (JVM) didn't collect unused classes or the
strings String or strings may refer to: *String (structure), a long flexible structure made from threads twisted together, which is used to tie, bind, or hang other objects Arts, entertainment, and media Films * ''Strings'' (1991 film), a Canadian anim ...
that are interned as a result of loading a class file. (This has changed in later versions of Java.) As a result, in the fall of 1998, Rhino added an interpretive mode. The classfile generation code was moved to an optional, dynamically loaded package. Compiling is faster and when scripts are no longer in use they can be collected like any other Java object. Rhino was released to Mozilla Foundation in April 1998. Originally Rhino classfile generation had been held back from release. However the licensors of Rhino have now agreed to release all of Rhino as
open source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
, including class file generation. Since its release to open source, Rhino has found a variety of uses and an increasing number of people have contributed to the code. The project gets its name from the animal on the cover of the JavaScript book from
O'Reilly Media O'Reilly Media (formerly O'Reilly & Associates) is an American learning company established by Tim O'Reilly that publishes books, produces tech conferences, and provides an online learning platform. Its distinctive brand features a woodcut of an ...
. As of version 1.7R11 (May 2019), Rhino supports
Java 8 The Java (programming language), Java language has undergone several changes since Java Development Kit, JDK 1.0 as well as numerous additions of class (computer science), classes and packages to the standard library (computer science), li ...
and up, and supports a number of ECMAScript ES6/ES2015 features.


Use

Rhino converts JavaScript scripts into classes. Rhino works in both compiled and interpreted mode. It is intended to be used in desktop or server-side applications, hence there is no built-in support for the Web browser objects that are commonly associated with JavaScript. Rhino can be used as a debugger by using the Rhino shell. The JavaScript shell provides a simple way to run scripts in batch mode or within an interactive environment for exploratory programming. It can be used in applications by embedding Rhino. A slightly modified version of Rhino 1.6r2 comes bundled with the
Sun Microsystems Sun Microsystems, Inc. (Sun for short) was an American technology company that sold computers, computer components, software, and information technology services and created the Java programming language, the Solaris operating system, ZFS, the ...
release of Java SE version 6, which was released in December 2006. This makes it easier to integrate JavaScript as part of Java programs and to access Java resources from JavaScript. Other implementations of Java 6 may differ.


See also

* JavaScript engine * List of ECMAScript engines *
Nashorn (JavaScript engine) Nashorn is a JavaScript engine developed in the Java programming language originally by Oracle and later by the OpenJDK Community. It relies on the support for dynamically typed languages on the Java Platform (JSR 292) (a concept first realized i ...
- the now-deprecated successor to Rhino for the JVM, starting at Java 8


References


External links

* {{Java (Sun) JVM programming languages Mozilla JavaScript engines Cross-platform software Software using the Mozilla license