Questions tagged [rhino]

Mozilla Rhino is a JavaScript interpreter written in Java.

Rhino is the 100% open source JavaScript engine written in plain Java

Rhino is typically embedded in Java applications to offer JavaScript scripting capabilities, but can also be used from the command-line using the Rhino shell

Visit the Rhino project on GitHub or checkout the documentation

Use with

  • for questions about using the original / old runtime of Google Apps Script.
  • and for questions about migrating code from the old runtime to the new runtime or about using the old runtime as a workaround for new runtime issues.

Do not use with for questions that use the new Google Apps Script runtime.

975 questions
71
votes
5 answers

Javascript Engines Advantages

I am confused about JavaScript engines right now. I know that V8 was a big deal because it compiled JavaScript to native code. Then I started reading about Mozilla SpiderMonkey, which from what I understand is written in C and can compile…
Jan
  • 719
  • 1
  • 6
  • 3
51
votes
3 answers

Call external javascript functions from java code

By using Java Scripting API, I am able to execute JavaScript within Java. However, can someone please explain what I would need to add to this code in order to be able to call on functions that are in C:/Scripts/Jsfunctions.js import…
MRK187
  • 1,545
  • 2
  • 13
  • 20
36
votes
6 answers

How can you run Javascript using Rhino for Java in a sandbox?

Part of our java application needs to run javascript that is written by non-developers. These non-developers are using javascript for data formatting. (Simple logic and string concatenation mostly). My question is how can I setup the execution of…
delux247
  • 2,177
  • 3
  • 21
  • 29
35
votes
4 answers

Differences between Narwhal and Node.js

I'm new to Node.js and I have been reading about Narwhal that is a framework based on Rhino. My questions: If I'm using Node.js, could I use Narwhal and its libraries/modules? Aren't the libraries/modules in Narwhal I/O-blocked (why Node.js got…
never_had_a_name
  • 90,630
  • 105
  • 267
  • 383
31
votes
1 answer

What is the lifecycle and concurrency semantics of Rhino Script Engine

I am interested in the lifecycle and concurrency semantics of (Rhino) Script Engine and associated classes. Specifically: Is Bindings supposed to be thread safe? Should multiple threads be allowed to share a single ScriptEngine instance? ... or…
Dilum Ranatunga
  • 13,254
  • 3
  • 41
  • 52
29
votes
7 answers

Switching from Rhino to Nashorn

I have a Java 7 project which makes a lot of use of Javascript for scripting various features. Until now I was using Rhino as script engine. I would now like to move to Java 8, which also means that I will replace Rhino by Nashorn. How compatible is…
Philipp
  • 67,764
  • 9
  • 118
  • 153
28
votes
4 answers

JavaScript (Rhino) use library or include other scripts

In JDK6, is there a way to load multiple scripts, each in a file, and have the one script reference a method of another script? Sort of like "include"?
Ayman
  • 11,265
  • 16
  • 66
  • 92
24
votes
3 answers

rhino vs spidermonkey

I noticed ubuntu 10.04 removed the spidermonkey package. Rhino looks like it's still there though. What are the differences between rhino and spidermonkey (besides what language they're written in). And why did they remove spidermonkey?
Tyler Gillies
  • 1,857
  • 4
  • 22
  • 31
21
votes
2 answers

Using Rhino instead of ScriptEngine to run Javascript code in Java

Based on the discussion converting string representation of unknown date-format to Date in java, I want to use the JavaScript Date function in my App-Engine project. However, ScriptEngine does not work on App-Engine. So I need a little help…
learner
  • 11,490
  • 26
  • 97
  • 169
20
votes
6 answers

Warning: node.js detection failed, sbt will use the Rhino based Trireme JavaScript engine

I'm new to Play framework. Please explain the meaning of the below warning. Warning: node.js detection failed, sbt will use the Rhino based Trireme JavaScript engine instead to run JavaScript assets compilation, which in some cases may be orders of…
sij
  • 296
  • 3
  • 13
20
votes
4 answers

How can I start coding with Oracle's Nashorn JS Engine and when will it replace Rhino in the OpenJDK?

I'm looking for a way to start playing around with Oracle's new Nashorn JavaScript Engine. I've DL'd the latest OpenJDK 8 (b65) and it appears that Rhino is still the only included script engine. Anyone know when (or in which build) Nashorn will…
max
  • 2,346
  • 4
  • 26
  • 34
20
votes
1 answer

ReferenceError: "alert" is not defined

I am trying to call a java script function from java code. Here is my Java code public static void main(String[] args) throws FileNotFoundException { try { /** * To call a anonymous function from java script file …
Sanjay Jain
  • 3,518
  • 8
  • 59
  • 93
19
votes
3 answers

how to run a javascript function asynchronously, without using setTimeout?

its a server side Javascript (rhino engine), so setTimeout is not available. how to run a function asynchronously?
dark_ruby
  • 7,646
  • 7
  • 32
  • 57
18
votes
3 answers

Problems using Rhino on Android

I'm trying to use Mozilla Rhino in my Java application for Android to evaluate some JavaScript. I am using Eclipse + ADT plugin. First I tried simply downloading the Rhino .jar file from Mozilla's website and adding it to the project as a library in…
Liquid_Fire
  • 6,990
  • 2
  • 25
  • 22
18
votes
2 answers

Rhino: Java numbers don't behave like Javascript numbers

I have an instance of this Java class accessible in my Javascript program public class ContentProvider { public Object c(int n) { switch (n) { case 1: return 1.1; case 2: return 2.2; case 3: return 3.3; case 4: return…
lunicon
  • 1,690
  • 1
  • 15
  • 26
1
2 3
64 65