NOTICE! This is a static HTML version of a legacy Fiji BugZilla bug.

The Fiji project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Bug 1142 - eval("script", javascript) asks for downloading Javascript.jar when using Java 1.8
eval("script", javascript) asks for downloading Javascript.jar when using Jav...
Status: RESOLVED MOVED
Product: Fiji
Classification: Unclassified
Component: ImageJ2
unspecified
All All
: P5 enhancement
Assigned To: Curtis Rueden
Depends on:
Blocks:
 
Reported: 2015-08-17 03:51 CDT by Jan Eglinger
Modified: 2015-08-17 09:42 CDT
2 users (show)

See Also:

Description Jan Eglinger 2015-08-17 03:51:30 CDT
To reproduce, run Fiji using Java 1.8.0, then:

  - File > Open Samples > Bat Cochlea Volume
  - Image > Hyperstacks > Temporal-Color Code

A dialog appears asking if you want to download and install Javascript.jar. When you click ok, you end up with a local-only Javascript.jar, which I think is not intended.
Comment 1 Curtis Rueden 2015-08-17 08:02:56 CDT
Confirmed on OS X.
Comment 2 Wayne Rasband 2015-08-17 09:19:12 CDT
This is intentional. Nashorn, the JavaScript interpreter included with Java 8 is not compatible with the Rhino interpreter used in earlier versions of Java.
Comment 3 Jan Eglinger 2015-08-17 09:37:30 CDT
While this might be intentional for ImageJ 1.x, I suggest that it be changed for Fiji/ImageJ2:

  - A local-only Javascript.jar will never be seen and updated by the imagej-updater
  - There's a fully functional Javascript engine provided by scijava scripting. Introducing a second Javascript engine potentially leads to inconsistent behaviour when running the same script from within the script editor, or from a macro via `eval("script", "...")`.

  - Input harvesting doesn't work with the supplied Javascript.jar. Running the following code fails:

    eval("script", "// @String name\n"
     + "// @OUTPUT String greeting\n"
     + "greeting = \"Hello, \" + name + \"!\";\n"
     + "");

showing the error:
    ReferenceError: "name" is not defined. (line#3)


Re-opening this as "enhancement" then :)
Comment 4 Curtis Rueden 2015-08-17 09:42:48 CDT
We will have to solve this somehow on the ImageJ2 side, then.

The scripting-javascript plugin of SciJava _does_ still run most (nearly all?) scripts written with Rhino in mind, via the mozilla_compat.js compatibility script.

* https://github.com/scijava/scripting-javascript/commit/167d606b8ef18e502b8f16a530eccd2c55c5cf12
* https://github.com/imagej/imagej/issues/116

I filed an issue on GitHub:
https://github.com/imagej/imagej-legacy/issues/119