shabbir_a@yahoo.com schrieb:
> is there anyone who can help with this problem. I have a piece of
> java software that is sitting on my webserver. I can run the jar
[quoted text clipped - 5 lines]
>
> If I can, how?
It may be easier to use the classes of this app directly instead of
using the entire app as "black box".
If not, you may use this code to embedd a java console app:
// redirect standard output
java.io.ByteArrayOutputStream captureOut =
new java.io.ByteArrayOutputStream();
// flush system out and bind to capture buffer
PrintStream oOut = System.out;
PrintStream nOut = new PrintStream(captureOut);
oOut.flush();
System.setOut(nOut);
// call java app's main method
my.little.java.command.line.app.Main(/* arguments as String[] */)
// close capture buffer, reassign original system out
nOut.close();
System.setOut(oOut);
// write captured bytes (optional)
oOut.write(captureOut.toByteArray());
// captureOut.toString() == output of main
You may catch to much output, if other threads write to System.out
as well. Normally a web app should not do this, but use a logging
facility instead.
Kai
shabbir_a@yahoo.com - 19 Apr 2007 21:22 GMT
Thanks for the info Kai. You mentioned I can call the class
directly - I am new to java, so am not sure how to do this - can I
call the class directly from within a jsp page? Is the ability of a
jsp page a reduced version of java?
Thanks for the help.
--
--------------------------------- --- -- -
Posted with NewsLeecher v3.9 Beta 2
Web @ http://www.newsleecher.com/?usenet
------------------- ----- ---- -- -