You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tim Gross <ct...@wavecable.com> on 2013/03/14 05:34:33 UTC

Running a binary program from a JSP

Hi,

I want to know if it is possible to execute a binary program (written in C)
from within a JSP.  I would like to do this on the server side, not the
browser, in Tomcat6.  If it is possible, can somebody provide an example.
Sorry if I am using the wrong mailing list.  Feel free to redirect me if
that is the case.

Thanks,

Tim.

 


RE: Running a binary program from a JSP

Posted by Martin Gainty <mg...@hotmail.com>.
Hi Dan

Earlier I gave him an example of a DWR backend bean which handles the mechanics of Runtime.getRuntime().exec("cmd.,exe /C 'fubar'");

I *was* going to suggest using An Applet but I didnt want to spend the rest of the month twiddling the exact permutation of execute and read permissions

Thanks for the link!
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.

  


> Subject: Re: Running a binary program from a JSP
> From: dmikusa@vmware.com
> Date: Thu, 14 Mar 2013 08:06:06 -0400
> To: users@tomcat.apache.org
> 
> On Mar 14, 2013, at 12:34 AM, Tim Gross wrote:
> 
> > Hi,
> > 
> > I want to know if it is possible to execute a binary program (written in C)
> > from within a JSP. 
> 
> Yes.
> 
> > I would like to do this on the server side, not the
> > browser, in Tomcat6. If it is possible, can somebody provide an example.
> 
> Use...
> 
> http://docs.oracle.com/javase/6/docs/api/java/lang/Runtime.html
> 
> or
> 
> http://docs.oracle.com/javase/6/docs/api/java/lang/ProcessBuilder.html
> 
> Google can give you examples.
> 
> Dan
> 
> > Sorry if I am using the wrong mailing list. Feel free to redirect me if
> > that is the case.
> > 
> > Thanks,
> > 
> > Tim.
> > 
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
 		 	   		  

Re: Running a binary program from a JSP

Posted by Daniel Mikusa <dm...@vmware.com>.
On Mar 14, 2013, at 12:34 AM, Tim Gross wrote:

> Hi,
> 
> I want to know if it is possible to execute a binary program (written in C)
> from within a JSP.  

Yes.

> I would like to do this on the server side, not the
> browser, in Tomcat6.  If it is possible, can somebody provide an example.

Use...

http://docs.oracle.com/javase/6/docs/api/java/lang/Runtime.html

or

http://docs.oracle.com/javase/6/docs/api/java/lang/ProcessBuilder.html

Google can give you examples.

Dan

> Sorry if I am using the wrong mailing list.  Feel free to redirect me if
> that is the case.
> 
> Thanks,
> 
> Tim.
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Running a binary program from a JSP

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Tim,

On 3/14/13 12:34 AM, Tim Gross wrote:
> I want to know if it is possible to execute a binary program
> (written in C) from within a JSP.  I would like to do this on the
> server side, not the browser, in Tomcat6.  If it is possible, can
> somebody provide an example. Sorry if I am using the wrong mailing
> list.  Feel free to redirect me if that is the case.

Do yourself a favor and:

a) Don't do this
b) If you have to do it, do it in a servlet, not a JSP
c) Limit the number of concurrent requests that are allowed to execute
this child process
d) Don't forget to flush/consume all your child-process's streams

If you don't do (d), you'll probably bring your server to a halt
unless nobody ever triggers this particular feature.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlFDdr8ACgkQ9CaO5/Lv0PAADQCgmZccumNZBXYGjh9r57knUKfl
sFkAoJ1BuHia39evFI50mbP03B0T/YHZ
=4/BP
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org