Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > calling exe from servlet (started but not viewed)

Reply
Thread Tools

calling exe from servlet (started but not viewed)

 
 
dinakar31@gmail.com
Guest
Posts: n/a
 
      07-13-2006
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

 
Reply With Quote
 
 
 
 
ddimitrov
Guest
Posts: n/a
 
      07-13-2006
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

 
Reply With Quote
 
 
 
 
Chris Uppal
Guest
Posts: n/a
 
      07-13-2006
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


 
Reply With Quote
 
dinakar31@gmail.com
Guest
Posts: n/a
 
      07-14-2006
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


 
Reply With Quote
 
dinakar31@gmail.com
Guest
Posts: n/a
 
      07-14-2006
> 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

 
Reply With Quote
 
dinakar31@gmail.com
Guest
Posts: n/a
 
      07-17-2006
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


 
Reply With Quote
 
DebbieinFlorida DebbieinFlorida is offline
Junior Member
Join Date: Sep 2008
Posts: 3
 
      09-17-2008
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
 
Reply With Quote
 
rakhy_rakey rakhy_rakey is offline
Junior Member
Join Date: Jun 2010
Posts: 2
 
      06-17-2010
@Dinakar

Thanks dinakar. Calling exe from servlet worked for me. Thank you very much.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Servlet Error]- not a servlet class Jitender Java 2 10-17-2007 02:24 PM
Servlet error ...package Javax.servlet does not exist cormacdebarra@gmail.com Java 4 11-11-2006 01:55 PM
seeking servlet "Master" keep getting "Master/servlet/Master" not found. Tomcat 5.0.25 Doug McCann Java 1 08-05-2004 09:16 PM
Servlet question(Tomcat, web.xml, servlet-class, servlet-name) circuit_breaker Java 2 04-04-2004 03:26 AM
how to get my servlet configuration before the servlet is initialised Andy Fish Java 4 12-17-2003 09:47 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57