Launch an executable from client side


EJB design: Launch an executable from client side

  1. Launch an executable from client side (1 messages)

    I know i am in the wrong place... but i have tried several places on teh web and some body recommended me to try out this website ...

    my problem is to launch an exe file, say notepad ... so work flow is something like this
    1. you open up this webpage
    2. You click on a link/button .. essentially you trigger an event
    3. this results in opening up (say) notepad on your computer
    4. its assumed that notepad will reside at a pre-destined place, for instance c:\winnt

    i already have this java program which does the job from command line ... i understand I need to convert it either into an applet or a plug-in. i am also attaching code for this program

    PLEASE help me if you know, or kindly guide me to relevant resources
    import java.lang.*;

    public class RuntimeExecTest {
    public static void main(String[] args) {
       Runtime rt = Runtime.getRuntime();
       String[] callAndArgs = { "Notepad.exe"};

       try {
            Process child = rt.exec(callAndArgs);
            System.out.println("Process exit code is:" + child.exitValue());
       catch(IOException e) {
            System.err.println("IOException starting process!");
       catch(InterruptedException e) {
            System.err.println("Interrupted waiting for process!");

  2. Well, you have a couple of options here:

    1) You can create a signed applet (refer to for more information) and give that applet broad permissions to access the file system. You can then exec the notepad.exe from the applet. Creating a signed applet is not easy, however, and it's been quite awhile since I did that ;)

    2) You need to have some sort of resident code on the machine that is triggered when your JavaScript button is clicked. BEA used to have a utility part of WLS called Zero Administration Client (ZAC) that automatically created these mini-client side installation programs. The idea was this: the logic behind your program would be stored on the server in modules (JARs). Client applications would go to the site with the program. The client application would automatically download a platform dependent EXE (that was created by ZAC) and installed on the local machine. Your web page could invoke the client side EXE. When the EXE runs, it connects back to the server to check for updated modules and downloads those if necessary. But, this is besides the point -- the EXE is installed on the client and accessible from the web page. You could just write the code to spawn off Notepad as part of what gets generated into the EXE.

    I believe that BEA is referring people to Sun's Java WebStart utility which does the same behavior as ZAC.

    Good luck.