javascript ANT task no longer working in Oxygen-25.0

Having trouble installing Oxygen? Got a bug to report? Post it all here.
Ron Van den Branden
Posts: 65
Joined: Fri Jan 18, 2008 5:54 pm

javascript ANT task no longer working in Oxygen-25.0

Post by Ron Van den Branden »

Hi,

When upgrading from Oxygen-24.1 (with bundled Java version Java SE 8u202) to Oxygen-25.0 (with bundled Java version OpenJDK Temurin 17.0.4.1), I'm stumbling on an ANT script in my project which invokes the Javascript task:

Code: Select all

  <scriptdef name="replaceRegExp" language="javascript">
    <attribute name="string"/>
    <![CDATA[
      // javascript code
   ]]>    
  </scriptdef>
While this worked fine in Oxygen-24.1, Oxygen-25.0 is now throwing following error:

Code: Select all

Transformation failed. Unable to create javax script engine for javascript
...with following debug pointer:

Code: Select all

Java 15 has removed Nashorn, you must provide an engine for running JavaScript yourself. GraalVM JavaScript currently is the preferred option.
I realize this is a broader Java / ANT issue, but couldn't find much useful pointers on how to make my ANT script working again with Oxygen-25.0. I've tried including the ${oxygenHome}/lib/js.jar path explicitly in the ANT transformation's classpath, but that doesn't work.

Can anyone help me out?

Best,

Ron
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: javascript ANT task no longer working in Oxygen-25.0

Post by adrian »

Hi,

Note that this is not specific to v25.0, but to any distribution of Oxygen (even older versions) that bundles OpenJDK (11+) instead of Java 8.
Java 8 includes the Nashorn Javascript engine, but this engine was removed in Java 11+. For Oxygen's JS purposes we included Rhino (js.jar), but that doesn't seem to be enough for this particular situation.

As per the recommendation in the error message, you will most likely need the GraalVM JavaScript engine. I haven't had the chance to test this out yet.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply