In my plugin i need to run Nashorn with specific arguments. For this is in jdk class NashornScriptEngineFactory. Few days ago i updated sponge to v615 but every time i try to create a new instance the process throws an exception Noclassdeffound. Before i updated to the version 615 i was using some early 5xx build (something before event refactor) and this error has never occured.
Theres a small test.
import org.spongepowered.api.plugin.Plugin;
@Plugin(id = "test", name = "test")
public class main {
public main() {
test();
}
public static void main(String[] a) {
new main();
}
public void test() {
System.out.println(System.getProperty("java.version"));
try {
Class.forName("jdk.nashorn.api.scripting.NashornScriptEngineFactory");
System.out.println("ok");
} catch (ClassNotFoundException e) {
System.out.println("not found");
}
}
}
You need at least 1.8u40 NashornScriptEngineFactory (Nashorn API )
Running the jar as executable
$ java -jar test-1.0-SNAPSHOT.jar
1.8.0_60
ok
using the jar as a sponge plugin
[19:08:04] [Server thread/INFO]: Forge Mod Loader has identified 5 mods to load
[19:08:05] [Server thread/INFO]: Attempting connection with missing mods [mcp, F
ML, Forge, Sponge, test] at CLIENT
[19:08:05] [Server thread/INFO]: Attempting connection with missing mods [mcp, F
ML, Forge, Sponge, test] at SERVER
[19:08:05] [Server thread/INFO]: [test.main:test:19]: 1.8.0_60
[19:08:05] [Server thread/INFO]: [test.main:test:24]: not found
[19:08:05] [Server thread/INFO]: Processing ObjectHolder annotations