[opencms-dev] executing my own class?

Jason Trump jason.trump at brulant.com
Fri Apr 21 16:45:16 CEST 2006


I actually sent a response to your question yesterday... check your
inbox.  

Have you used the other variants of Runtime.getRuntime().exec(); for
example you could do something like

<%
	String[] args = { "dir", request.getParameter("arg1") };
	Process proc = Runtime.getRuntime().exec(args);
	// the rest of your code here...
%>

jt

> -----Original Message-----
> From: opencms-dev-bounces at opencms.org [mailto:opencms-dev-
> bounces at opencms.org] On Behalf Of Christoph P. Kukulies
> Sent: Friday, April 21, 2006 5:06 AM
> To: opencms-dev at opencms.org
> Subject: Re: [opencms-dev] executing my own class?
> 
> On Fri, Apr 21, 2006 at 10:19:32AM +0200, Christoph P. Kukulies wrote:
> > OK, I have no spontaneous reaction on my yesterdays' question
> > on how to execute a server side binary executable.
> > Three possible causes:
> > My question is of the kind RTFM,too profane, or too difficult. :-)
> >
> > I had an Executor.class in a previous web-application I wrote and if
> > I were able to put that class into a jsp I would probably be done.
> >
> > Would be that the way to go?
> 
> Following my own thread: Here is the code snippet that works so far:
> 
> <%@page import="java.io.*" %>
> <%
>     try {
>       int b;
>       Runtime runner= Runtime.getRuntime();
>       String cmd="DIR";
>       Process p=runner.exec(cmd);
>       InputStream i=p.getInputStream();
>       out.println("<html><pre><b>"+ "Executing:</b>"
> +cmd+"<br>"+"<b>Result:</b>");
>       out.flush();
>       while((b=i.read()) >=0) {
>               out.write(b);out.flush();
>       }
>       out.println("</html>");
>      } catch(Exception e) {
>                     out.println("exception occured");
>                     out.flush();
>                     e.printStackTrace();
>      }
> %>
> 
> But how can I pass arguments from a FORM now?
> 
> --
> Chris Christoph P. U. Kukulies kukulies (at) rwth-aachen.de
> 
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please
visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev



More information about the opencms-dev mailing list