calling exe from servlet (started but not viewed)

Discussion in 'Java' started by dinakar31@gmail.com, Jul 13, 2006.

  1. Guest

    Hi,
    I am using tomcat webserver and jdk1.5.0
    I tried to open exe files from servlet and jsp. My problem is that the
    program that I am trying to open is started(as I could see it in
    windows task manager) but I couldnot find it on screen.
    Is there a work around or am I going wrong somewhere.
    Here is my code:
    -------------
    Runtime rt=Runtime.getRuntime();
    String cmd[]={"cmd.exe", "/C", "c:\\windows\\notepad.exe"};
    rt.exec(cmd);
    -------------
    I didnot use waitFor() here.

    Regards,
    Dinakar
     
    , Jul 13, 2006
    #1
    1. Advertising

  2. ddimitrov Guest

    What exactly do you expect to see?

    You won't see a new windows console as the standard in/out is piped
    into the Java process that spawned the cmd.exe.

    That said, you have to consume the output as otherwise your child
    process would block when it fills the OS buffer. Check the javadoc of
    the Process class (returned by rt.exec()).

    Another class ou might want to check is ProcessBuilder.

    --
    Dimitar
     
    ddimitrov, Jul 13, 2006
    #2
    1. Advertising

  3. Chris Uppal Guest

    wrote:

    > I am using tomcat webserver and jdk1.5.0
    > I tried to open exe files from servlet and jsp. My problem is that the
    > program that I am trying to open is started(as I could see it in
    > windows task manager) but I couldnot find it on screen.
    > Is there a work around or am I going wrong somewhere.


    Is Tomcat running as a service ? If so then the notepad.exe will run as
    whatever user is configured for that service, and will probably not (and should
    not) have access to the desktop.

    (BTW, you do /intend/ to open notepad.exe on the server, don't you ?)

    -- chris
     
    Chris Uppal, Jul 13, 2006
    #3
  4. Guest

    Hi,

    Actually, I wanted to open a VB application from servlet and need fill
    some fields. Is it not possible to give user interaction to the
    applications opened from java ? I still have to look into
    ProcessBuilder class.

    Regards,
    Dinakar

    ddimitrov wrote:
    > What exactly do you expect to see?
    >
    > You won't see a new windows console as the standard in/out is piped
    > into the Java process that spawned the cmd.exe.
    >
    > That said, you have to consume the output as otherwise your child
    > process would block when it fills the OS buffer. Check the javadoc of
    > the Process class (returned by rt.exec()).
    >
    > Another class ou might want to check is ProcessBuilder.
    >
    > --
    > Dimitar
     
    , Jul 14, 2006
    #4
  5. Guest

    > Is Tomcat running as a service ? If so then the notepad.exe will run as
    > whatever user is configured for that service, and will probably not (and should
    > not) have access to the desktop.
    >
    > (BTW, you do /intend/ to open notepad.exe on the server, don't you ?)
    >
    > -- chris


    Ya, Tomcat is running as a service. I just opted for "Allow service to
    interact with desktop" and I think it's working, I will post the status
    after I confirm the matter.
    Thanks chris.

    Regards,
    Dinakar
     
    , Jul 14, 2006
    #5
  6. Guest

    Opted for the 'Access to desktop' option in tomcat service properties
    and it worked for me.

    Thanx guys,
    Dinakar

    wrote:
    > > Is Tomcat running as a service ? If so then the notepad.exe will run as
    > > whatever user is configured for that service, and will probably not (and should
    > > not) have access to the desktop.
    > >
    > > (BTW, you do /intend/ to open notepad.exe on the server, don't you ?)
    > >
    > > -- chris

    >
    > Ya, Tomcat is running as a service. I just opted for "Allow service to
    > interact with desktop" and I think it's working, I will post the status
    > after I confirm the matter.
    > Thanks chris.
    >
    > Regards,
    > Dinakar
     
    , Jul 17, 2006
    #6
  7. DebbieinFlorida

    Joined:
    Sep 16, 2008
    Messages:
    2
    executing Vb from jsp

    Dinakar,

    I am new (2 days) to this stuff, but I have to get access to my VB.exe asap from a .jsp. Please show me your servelet and how you did this. I would really appreciate it.. I also do not understand what you meant by allowing access to desktop??? my Test.exe is on C:\ directory. I can run it in command line, but that is all.

    Thanks
     
    DebbieinFlorida, Sep 17, 2008
    #7
  8. rakhy_rakey

    Joined:
    Jun 17, 2010
    Messages:
    2
    It helped me

    @Dinakar

    Thanks dinakar. Calling exe from servlet worked for me. Thank you very much.
     
    rakhy_rakey, Jun 17, 2010
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alek Davis

    aspnet_wp.exe could not be started

    Alek Davis, Jul 7, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    3,585
  2. Lynn
    Replies:
    4
    Views:
    2,592
  3. circuit_breaker
    Replies:
    2
    Views:
    2,045
    Jack Jia
    Apr 4, 2004
  4. Jake Barnes
    Replies:
    2
    Views:
    319
  5. Gabriella
    Replies:
    0
    Views:
    103
    Gabriella
    Sep 21, 2006
Loading...

Share This Page