简体   繁体   中英

Accessing Java Applet non-static methods using Java

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 .

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM