0

Suppose I have a HTML page (which happens to be generated and served by Java EE) that has a button and when pressing this button, I want a Windows application to be run on the local computer ( i.e. Word oder Excel). How do I achieve this? I have tried this but it hasn't worked.

Community
  • 1
  • 1
newbie
  • 117
  • 12
  • is this what you are looking for? http://docs.oracle.com/javase/6/docs/api/java/awt/Desktop.html#open(java.io.File) – bwright Oct 14 '15 at 14:06
  • Unfortunately that is not what i was looking for. It fails at the communication between application ( browser ) and windows. – newbie Oct 14 '15 at 14:28
  • ahh you are trying to do that from the browser. I doubt that this is possible due to security issues. – bwright Oct 14 '15 at 14:43
  • Are you sure about that? Even with an encrypted communication setup? Even if i am only using the application on the server ( LAN) ? – newbie Oct 14 '15 at 14:56
  • no i am not sure about that. – bwright Oct 14 '15 at 15:00
  • This process is probably not advised at all due to security issues as bwright as mentioned. The only workaround is to use nasty ActiveX or VBScript components for the front end (which is never good) or if the host is local, start a process via the backend code. – Anthony Sherratt Oct 18 '15 at 09:27
  • Can you give an example of how such backend code could look like? – newbie Oct 19 '15 at 07:50

1 Answers1

-1

I think what you're looking for is basically possible in java. All you have to do is to put this line of code at your server side like:

Runtime.getRuntime().exec( new String[] { "open", "/path/to/app/SomeApp.app"} );

This'll open the app at the server side. Obviously you'll have to run eclipse (or the IDE you're using) with admin permission to achieve this. Is that what you're looking for?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Géraud Willing B-S
  • 273
  • 1
  • 2
  • 17