I have some legacy java & fx code that built perfectly in older versions of Java and Netbeans (using ANT).
I recently revisited this to upgrade the ide and jdk/jre for java and fx. Of course, it fails to build because Nashorn was pulled out. Ok - I got that.
I have to admit, I am freaking stumped at how I can just get graalvm set to take over in nashorn compatibility mode to process the build javascript.
Some will say dump ant and go with maven, etc., but for right now, I just want to build this without restructuring anything.
So, is there anyone out there who knows exactly where in Netbeans (12.5) I have to make changes and which changes I have to make so that javascript will work again like it did under Nashorn and ANT?
I've read all the docs and frankly, my head is spinning. Graalvm does many more things than I need right now.
Can anyone help?
Thanks!
While Nashorn was removed from JDK 15, it lives on as a standalone OpenJDK project (similar to e.g. JavaFX).
You could drop-in standalone Nashorn JAR file as a dependency to your Ant build and carry on. That'd be the minimal change you'd need.
Putting it in your Ant lib directory should work. By default that's $ANT_HOME/lib but some Ant installations use a different location, e.g. homebrew-installed Ant will use /usr/local/share/ant. If you don't want to put it in the lib, you can also put it with your project and use <classpath> or <classpathref> within the <script> tag to point to it.
You can downloaded the JAR from Maven Central; be sure to check the POM file for the the dependencies you'll also have to get (few ASM JARs.) If you're using some dependency manager (Gradle, Maven, what have you) then it will pull them automatically.