Rhino (JavaScript engine): Difference between revisions

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
imported>P3k
m Update main URL
 
imported>Jerryobject
Template:Infobox software parameters update-standardize: moves. Small WP:COPYEDITs WP:EoS: clarify, WP:TERSE. WP:LINKs: update-standardizes, adds, needless-WP:PIPEs > WP:NOPIPEs.
 
Line 1: Line 1:
{{Short description|JavaScript engine written in Java}}
{{Short description|JavaScript engine written in Java}}
{{Multiple issues|
{{Multiple issues|
{{more citations needed|date=June 2011}}
{{More citations needed|date=June 2011}}
{{primary sources|date=April 2012}}
{{Primary sources|date=April 2012}}
}}
}}
{{Infobox software
{{Infobox software
| name = Rhino
| name = Rhino
| logo = Inicio de ldp para 260px50px moziyarinocrnt.jpg
| logo = Inicio de ldp para 260px50px moziyarinocrnt.jpg
| screenshot =  
| screenshot =  
| caption =
| author = Norris Boyd
| author = Norris Boyd
| caption =
| developer = 1997: [[Mozilla Foundation]]<br/>1998: [[Mozilla Corporation]]<br/>Present: volunteers
| developer = 1997: [[Mozilla Foundation]], 1998: [[Mozilla Corporation]], now developed by volunteers.
| latest release version = 1.8.0
| latest release version = 1.8.0
| latest release date = {{start date and age|2025|01|03}}
| latest release date = {{Start date and age|2025|01|03}}
| latest preview version =  
| repo = {{URL|https://github.com/mozilla/rhino}}
| latest preview date =
| operating system = [[Cross-platform software|Cross-platform]]
| operating system = [[Cross-platform]]
| platform = [[Java virtual machine]]
| platform = [[Java virtual machine]]
| language =  
| language =  
Line 22: Line 20:
| genre = [[JavaScript engine]]
| genre = [[JavaScript engine]]
| license = [[Mozilla Public License|MPL 2.0]]
| license = [[Mozilla Public License|MPL 2.0]]
| website = {{URL|https://rhino.github.io/}}
| website = {{URL|rhino.github.io}}
| repo = {{URL|https://github.com/mozilla/rhino}}
}}
}}


'''Rhino''' is a [[JavaScript engine]] written fully in [[Java (programming language)|Java]] and managed by the [[Mozilla Foundation]] as [[open source software]]. It is separate from the [[SpiderMonkey (JavaScript engine)|SpiderMonkey]] engine, which is also developed by Mozilla, but written in [[C++]] and used in [[Mozilla Firefox]].
'''Rhino''' is a [[JavaScript engine]] to run the [[JavaScript]] [[programming language]] written fully in [[Java (programming language)|Java]] language and managed by the [[Mozilla Foundation]] as [[free and open-source software]]. It is separate from the [[SpiderMonkey]] engine, which is also developed by Mozilla, but written in the [[C++]] language and used in the [[Firefox]] [[web browser]].


== History ==
== History ==
The Rhino project was started at [[Netscape Communications Corporation|Netscape]] 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]]) have licensed Rhino for use in their products and paid Netscape to do so, allowing work to continue on it.
The Rhino project began at [[Netscape]] in 1997, when they planned to produce a version of [[Netscape Navigator]] web browser written fully in Java, which 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]]) 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]]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 [[memory leak|leaked memory]] since most [[Java virtual machine]]s (JVM) didn't [[garbage collection (computer science)|collect]] unused classes or the [[String (computer science)|strings]] that are [[String interning|interned]] as a result of loading a class file.{{Citation needed|date=February 2010}} (This has changed in later versions of Java.)
Originally, Rhino [[Compiler|compiled]] all JavaScript code to [[Java bytecode]] in generated [[Java class file]]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, [[compile time]] was long since generating [[bytecode]] and loading the generated [[Class (computer programming)|classes]] was a resource-intensive process. Also, the implementation effectively [[memory leak|leaked memory]] since most [[Java virtual machine]]s (JVM) didn't [[garbage collection (computer science)|collect]] unused classes or the [[String (computer science)|strings]] that are [[String interning|interned]] as a result of loading a class file.{{Citation needed|date=February 2010}} (This changed in later Java versions.)


As a result, in the fall of 1998, Rhino added an interpretive mode. The classfile generation code was moved to an optional, [[dynamic loading|dynamically loaded]] package. Compiling is faster and when scripts are no longer in use they can be collected like any other Java object.
As a result, in the fall of 1998, Rhino added an [[Interpreter (computing)|interpreted]] mode. The classfile generation code was moved to an optional, [[dynamic loading]] package. Compiling is faster and when scripts are no longer in use they can be collected like any other Java [[Object (computer science)|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 software|open source]], 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.<ref>{{cite web |url = https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/History |title = Rhino History |publisher = [[Mozilla Foundation]] |access-date = 2008-03-20 |archive-url=https://web.archive.org/web/20201022021252/https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/History |archive-date=22 October 2020 |url-status=dead}}</ref> The project gets its name from the animal on the cover of the JavaScript book from [[O'Reilly Media]].<ref>[http://www.oreilly.com/catalog/jscript5/ O'Reilly's Javascript book, inspiration for the Rhino name]</ref> As of version 1.80 (January 2025), Rhino supports [[Java version history|Java 11]] and up, and supports a number of [[ECMAScript]] ES6/ES2015 features.<ref>{{cite web|url=https://mozilla.github.io/rhino/compat/engines.html|title=Rhino ES2015 Support|publisher=Mozilla Foundation|access-date=2025-01-03}}</ref>
Rhino was released to [[Mozilla Foundation]] in April 1998. Originally Rhino classfile generation had been held back from release. However the licensors of Rhino agreed to release all of Rhino as [[free and open-source software]], 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.<ref>{{cite web |url = https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/History |title = Rhino History |publisher = [[Mozilla Foundation]] |access-date = 2008-03-20 |archive-url=https://web.archive.org/web/20201022021252/https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/History |archive-date=22 October 2020 |url-status=dead}}</ref> The project gets its name from the animal on the cover of the JavaScript book from [[O'Reilly Media]].<ref>[http://www.oreilly.com/catalog/jscript5/ O'Reilly's Javascript book, inspiration for the Rhino name]</ref> As of version 1.80 (January 2025), Rhino supports [[Java version history|Java 11]] and up, and supports many [[ECMAScript]] ES6/ES2015 features.<ref>{{cite web|url=https://mozilla.github.io/rhino/compat/engines.html|title=Rhino ES2015 Support|publisher=Mozilla Foundation|access-date=2025-01-03}}</ref>


== Use ==
== Use ==
Rhino converts JavaScript scripts into [[class (computer programming)|classes]]. Rhino works in both [[compiler|compiled]] and [[interpreter (computing)|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 converts JavaScript scripts into [[Class (computer programming)|classes]]. Rhino works in both [[compiler|compiled]] and [[interpreter (computing)|interpreted]] mode. It is intended to be used in [[Client–server model|client 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 [[command line interface|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.
Rhino can be used as a [[debugger]] by using the Rhino [[command-line interface]] or [[Shell (computing)|shell]]. The JavaScript shell provides a simple way to run scripts in [[batch processing]] mode or in an [[Interactive computing]] environment for [[exploratory programming]]. It can be used in applications by embedding Rhino.


A slightly modified version of Rhino 1.6r2 comes [[software bundling|bundled]] with the [[Sun Microsystems]] 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.
A slightly modified version of Rhino 1.6r2 comes [[Product bundling|bundled]] with the [[Sun Microsystems]] 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 ==
== See also ==
Line 48: Line 45:
* [[JavaScript engine]]
* [[JavaScript engine]]
* [[List of ECMAScript engines]]
* [[List of ECMAScript engines]]
* [[Nashorn (JavaScript engine)]] - the now-deprecated successor to Rhino for the JVM, starting at Java 8
* [[Nashorn (JavaScript engine)]] – a now-deprecated successor to Rhino for the JVM, starting at Java 8


== References ==
== References ==
{{reflist}}
{{Reflist}}


== External links ==
== External links ==
* {{Official website|http://mozilla.github.io/rhino/}}
* {{Official website|mozilla.github.io/rhino}}


{{Mozilla projects}}
{{Mozilla projects}}

Latest revision as of 05:59, 24 June 2025

Template:Short description Template:Multiple issues Script error: No such module "Infobox".Template:Template otherScript error: No such module "Check for unknown parameters".Template:Main other

Rhino is a JavaScript engine to run the JavaScript programming language written fully in Java language and managed by the Mozilla Foundation as free and open-source software. It is separate from the SpiderMonkey engine, which is also developed by Mozilla, but written in the C++ language and used in the Firefox web browser.

History

The Rhino project began at Netscape in 1997, when they planned to produce a version of Netscape Navigator web browser written fully in Java, which 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) 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 files. 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, compile 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 machines (JVM) didn't collect unused classes or the strings that are interned as a result of loading a class file.Script error: No such module "Unsubst". (This changed in later Java versions.)

As a result, in the fall of 1998, Rhino added an interpreted mode. The classfile generation code was moved to an optional, dynamic loading 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 agreed to release all of Rhino as free and open-source software, 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.[1] The project gets its name from the animal on the cover of the JavaScript book from O'Reilly Media.[2] As of version 1.80 (January 2025), Rhino supports Java 11 and up, and supports many ECMAScript ES6/ES2015 features.[3]

Use

Rhino converts JavaScript scripts into classes. Rhino works in both compiled and interpreted mode. It is intended to be used in client 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 command-line interface or shell. The JavaScript shell provides a simple way to run scripts in batch processing mode or in an Interactive computing 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 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

Script error: No such module "Portal".

References

Template:Reflist

External links

Template:Mozilla projects Template:ECMAScript Template:Java (Sun)

  1. Script error: No such module "citation/CS1".
  2. O'Reilly's Javascript book, inspiration for the Rhino name
  3. Script error: No such module "citation/CS1".