Can you inject java classes during script execution?
Closed this issue · 0 comments
Pexien commented
I have a class which I am injecting as an object in to the runtime
public class JavaManager {
private V8 runtime;
public InjectJava(V8 runtime) {
this.runtime = runtime;
}
public void importClass(String className) {
try {
V8JavaAdapter.injectClass(Class.forName(className), runtime);
} catch (Exception e) {
e.printStackTrace();
}
}
}
so I can inject classes using Java.injectClass('class')
in a script, similar to how import and require work, but instead with Java classes. However, when loading the script with J2V8 I get a java.lang.Error: Runtime disposed error
error? Any ideas of how to solve this, or am I just missing something?