[opencms-dev] executing my own class?
Christoph P. Kukulies
kuku at physik.rwth-aachen.de
Fri Apr 21 11:05:40 CEST 2006
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
More information about the opencms-dev
mailing list