I'm trying to access non-static methods in a java applet, through javascript.
I access static methods using the Syntax AppletName.Packages.className.methodName();
and it works.
If I try to access a non-static member/method via JavaScript, I get an error " Error calling method on NPObject
", but nothing on the Java Console.
Is there a way to access non-static applet methods from Javascript?
You need to instantiate a java object, then you can call your methods.
var myClass = new AppletName.Packages.className();
myClass.methodName();
From here .
请参阅从Javascript调用Java方法 。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.