| 1 | # Rhino: JavaScript in Java |
| 2 | |
| 3 |  |
| 4 | |
| 5 | Rhino is an implementation of JavaScript in Java. |
| 6 | |
| 7 | ## License |
| 8 | |
| 9 | Rhino is licensed under the [MPL 2.0](./LICENSE.txt). |
| 10 | |
| 11 | ## Releases |
| 12 | |
| 13 | <table> |
| 14 | <tr><td><a href="https://github.com/mozilla/rhino/releases/tag/Rhino1_7R5_RELEASE">Rhino 1.7R5</a></td><td>January 29, 2015</td></tr> |
| 15 | <tr><td><a href="https://github.com/mozilla/rhino/releases/tag/Rhino1_7_6_RELEASE">Rhino 1.7.6</a></td><td>April 15, 2015</td></tr> |
| 16 | <tr><td><a href="https://github.com/mozilla/rhino/releases/tag/Rhino1_7_7_RELEASE">Rhino 1.7.7</a></td><td>June 17, 2015</td></tr> |
| 17 | <tr><td><a href="https://github.com/mozilla/rhino/releases/tag/Rhino1_7_7_1_RELEASE">Rhino 1.7.7.1</a></td><td>February 2, 2016</td></tr> |
| 18 | <tr><td><a href="https://github.com/mozilla/rhino/releases/tag/Rhino1_7_7_2_RELEASE">Rhino 1.7.7.2</a></td><td>August 24, 2017</td></tr> |
| 19 | </table> |
| 20 | |
| 21 | [Release Notes](./RELEASE-NOTES.md) for recent releases. |
| 22 | |
| 23 | [Compatability table](http://mozilla.github.io/rhino/compat/engines.html) which shows which advanced JavaScript |
| 24 | features from ES5, 6, and 7 are implemented in Rhino. |
| 25 | |
| 26 | ## Documentation |
| 27 | |
| 28 | Information for script builders and embedders: |
| 29 | |
| 30 | [https://developer.mozilla.org/en-US/docs/Rhino_documentation](https://developer.mozilla.org/en-US/docs/Rhino_documentation) |
| 31 | |
| 32 | JavaDoc for all the APIs: |
| 33 | |
| 34 | [http://mozilla.github.io/rhino/javadoc/index.html](http://mozilla.github.io/rhino/javadoc/index.html) |
| 35 | |
| 36 | More resources if you get stuck: |
| 37 | |
| 38 | [https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/Community](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/Community) |
| 39 | |
| 40 | ## Building |
| 41 | |
| 42 | ### How to Build |
| 43 | |
| 44 | Rhino builds with `Gradle`. Here are some useful tasks: |
| 45 | ``` |
| 46 | ./gradlew jar |
| 47 | ``` |
| 48 | Build and create `Rhino` jar in the `build/libs` directory. |
| 49 | ``` |
| 50 | ./gradlew test |
| 51 | ``` |
| 52 | Build and run all the tests. |
| 53 | ``` |
| 54 | ./gradlew testBenchmark |
| 55 | ``` |
| 56 | Build and run benchmark tests. |
| 57 | |
| 58 | ## Releasing and publishing new version |
| 59 | |
| 60 | 1. Ensure all tests are passing |
| 61 | 2. Remove `-SNAPSHOT` from version in `gradle.properties` in project root folder |
| 62 | 3. Create file `gradle.properties` in `$HOME/.gradle` folder with following properties. Populate them with maven repo credentials and repo location. |
| 63 | ``` |
| 64 | mavenUser= |
| 65 | mavenPassword= |
| 66 | mavenSnapshotRepo= |
| 67 | mavenReleaseRepo= |
| 68 | ``` |
| 69 | |
| 70 | 4. Run `Gradle` task to publish artifacts to Maven Central. |
| 71 | ``` |
| 72 | ./gradlew publish |
| 73 | ``` |
| 74 | 5. Increase version and add `-SNAPSHOT` to it in `gradle.properties` in project root folder. |
| 75 | 6. Push `gradle.properties` to `GitHub` |
| 76 | |
| 77 | ## Running |
| 78 | |
| 79 | Rhino can run as a stand-alone interpreter from the command line: |
| 80 | ``` |
| 81 | java -jar buildGradle/libs/rhino-1.7.7.2.jar |
| 82 | Rhino 1.7.7.2 2017 08 24 |
| 83 | js> print('Hello, World!'); |
| 84 | Hello, World! |
| 85 | js> |
| 86 | ``` |
| 87 | You can also embed it, as most people do. See below for more docs. |
| 88 | |
| 89 | ## Issues |
| 90 | |
| 91 | Most issues are managed on GitHub: |
| 92 | |
| 93 | [https://github.com/mozilla/rhino/issues](https://github.com/mozilla/rhino/issues) |
| 94 | |
| 95 | ## More Help |
| 96 | |
| 97 | The Google group is the best place to go with questions: |
| 98 | |
| 99 | [https://groups.google.com/forum/#!forum/mozilla-rhino](https://groups.google.com/forum/#!forum/mozilla-rhino) |
| 100 | |
| 101 |