简体   繁体   中英

How to call Dll method from JSNI to use in GWT web application?

I have a GWT web application.

It calls method from another class(using JSNI method).

But I want to Call a dll method from that class...How can i do that?

public class external_class {
public native void shows()/*-{window.alert("hello");}-*/;
}

in GWT web application calling like

external_class obj = new external_class();
            obj.shows();

how can I invoke shows() method if I defined it in a dll file? or how can i directly call a dll method from GWT application through JSNI?

please give me a solution....

You can not call a DLLs in GWT. GWT compiles Java code to Javascript code which runs inside a webbrowser. Javascript can not call DLLs directly, if you want to do something with a DLL I suggest you take a look into browser plugins.

In browser plugins you can include your dll (only windows) and have your javascript call that plugin.

To me it looks like you need to use an Applet and jnlp to load the native libraries in. From there you can communicate between GWT and the applet using the JSObject or a library like GWT-AI (personally I just code this by hand, I have only used GWT-AI a few times). I believe for the applet side you could use JNA for your bindings.

If this doesn't make sense, or sounds a bit like gibberish, you may need to enlist help, a lot can go wrong bringing between java and native libraries, and you may need more specialized help to actually make progress on this, it's tricky.

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