This content has been marked as final. Show 7 replies
I can think of a few options. Truthfully, I think it would be easier in the long run if you rework the java method(s) to return the values you need so you can easily use them in ColdFusion. They can return a simple value like an int egeror a structure type object (ie. multiple values)
Another simple option is to run the clases using the command line java.exe program (using cfexecute). Then save the output to a file and parse it.
Thanks for the tip, however the printlns are everywhere. I was hoping that I wouldn't have to modify the java code in case another app was calling them. The methods are called from within a html wrapper and the raw output dumped into a DIV.
I'll give the cfexecute a shot again; I had tried this a few hours ago with no luck.
You can also add a new method, if you're concerned about changing existing methods.
Still banging my head against a wall. After doing some checking, I think I'm the only one using these java apps, but still the "println" is in hundreds of locations. Is there a way to redirect the output or feed it back to the calling CF template? I've tried CFOBJECT and CFEXECUTE and am getting nowhere. I've also tried using System.setOut(), but don't know what I'm doing.
Please keep in mind, that I'm fresh to java, so I could use code samples that I could cut/paste with little modification. Running these apps from the commandline gives me the proper output, I just can't get that same output back into my web page. If the printlns were everywhere, I could return the strings (maybe?). Lastly, I'm warry that if I write the strings out to file, that these apps are run asych so I'd have to design a filing scheme or risk overwrite.
Thanks for your patience with a frassled newbie.
I finally figured out how to redirect the output stream and then return the var's .toString().
public static String main(String args)
ByteArrayOutputStream outstream = new ByteArrayOutputStream();
PrintStream ps = new PrintStream( outstream );
System.setOut( ps );
if ( args.length < 1 )
System.out.println("usage: java InetLoad inet_sales_spreadsheet");
Time for a beer.
Glad you figured it out. I probably still lean towards returning values from the method(s) instead of using System.out.println ;-) .. but since you said there are 100's of output lines, redirecting the output sounds like a good choice for now.
> Time for a beer.
Have two. You earned it ;-)