Calling an external application (i.e. Windows Calculator) in a GWT web application

后端 未结 4 1520
轮回少年
轮回少年 2021-01-24 21:41

I am trying to call an external windows application (i.e. calc.exe) when a user clicks on a button in a GWT web application. Is there a way on how to do it?

Below are w

相关标签:
4条回答
  • 2021-01-24 22:12

    I see. Thanks for the answers guys. I'm still a newbie in GWT. Your answers helped me understand more about GWT and how it compiles classes to javascript as well as the idea behind why webapp should not be allowed access to local resources. However, I think there are still exceptions though depending on the need and scenarios; in my case, my webapp is only used and accessed in a closed group/network and not for public/anyone's use.

    For anyone who is also interested, What I did is I created a javascript code that uses an ActiveXObject implementation to run the external apps, in my case a windows calculator. Then using this code, I run this in an IE browser since only IE fully supports ActiveX implementation.

    I haven't tried Braj's suggestion above but I think it's also one alternative that will work. Maybe I'll try playing with that approach this weekend.

    0 讨论(0)
  • 2021-01-24 22:14

    A webapp should not and can not call a local program..

    GWT compiles client classes to javascript and there's no support for Runtime, so GWT doesn't know how to transform your Runtime usage to JS.

    For a list of GWT supported classes (client side), see http://www.gwtproject.org/doc/latest/RefJreEmulation.html

    0 讨论(0)
  • 2021-01-24 22:16

    You cannot do it. Browsers do not allow access to executable files on a user's computer. It would have been a dream-come-true for every hacker out there.

    0 讨论(0)
  • 2021-01-24 22:25

    Use Java Applet to call an external application in GWT using JSNI.

    Please have a look at below links for sample code.

    Invoking Applet Methods From JavaScript Code

    Call Java Applet function from Javascript

    How to call Applet method from javascript

    0 讨论(0)
提交回复
热议问题