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
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.
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
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.
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