Closed larsborn closed 1 year ago
I'm encountering this issue with OpenJDK 16. I then read this version of OpenJDK removed the JavaScript engine, so I tried v11 but receive the error Unable to locate script class: HashDB.java
. Any help is much appreciated! I'd love to get this working on Ghidra v 10.1.5.
This can be reproduced by running a lookup whilst running Ghidra under any of the following:
<OpenJDK any architecture Version 15+>
As documented here the Nashorn script engine has been removed, which was the provider for the "JavaScript" engine type. They've done this as they were having trouble maintaining it and keeping it compatible with ECMAScript standards.
Unfortunately the following code shows that in OpenJDK 15+ there are actually no engine candidates at all.
import java.util.List;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineFactory;
import javax.script.ScriptEngineManager;
public class ListEngines {
public static void main(String args[]) {
ScriptEngineManager manager = new ScriptEngineManager();
List<ScriptEngineFactory> factories = manager.getEngineFactories();
for (ScriptEngineFactory factory : factories) {
System.out.println(factory.getEngineName());
System.out.println(factory.getEngineVersion());
System.out.println(factory.getLanguageName());
System.out.println(factory.getLanguageVersion());
System.out.println(factory.getExtensions());
System.out.println(factory.getMimeTypes());
System.out.println(factory.getNames());
}
}
}
My current thoughts are:
Have been researching alternatives to the nashorn script engine. it's all a bit messy but will update if I find a simple replacement that can be slotted straight in.
I've moved to jython to handle the transform: https://github.com/OALabs/hashdb-ghidra/compare/main...matthw:hashdb-ghidra:main
The
engine
variable may be `null. Show a warning and disable the corresponding UI elements.