We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
println() from application? (Read 4999 times)
println() from application?
Jun 16th, 2010, 4:57pm
 
Is it possible to display println() output from an exported application if called from a command-line?  For example:
Quote:
println("Hello World!");
exit();

..when the exported executable is run from the command-line (Windows) there is no output.  I think it's due to the ShellExecuteEx() call inside the launcher.exe - as the explorer shell wouldn't have a "stdout pipe".

 Is there perhaps an alternate method of launching the jars in the lib folder that might retain println() output?  (i've been unsuccessful so far in my 'java -jar' hacking to launch them, keep getting class not found problems that it seems i shouldn't be getting, but probably i'm just specifying something wrong, classpath, etc?)

tia
Re: println() from application?
Reply #1 - Jun 17th, 2010, 1:59am
 
The Windows exe is probably generated in GUI mode (to avoid the usual ugly CMD window we get when we run lot of Java applications). These GUI applications have no stdout.
The usual workaround is to make a kind of logger (or to use a real one), writing output to a file (I shown one I made to test an e-mail application which was problematic when exported).
Re: println() from application?
Reply #2 - Jun 17th, 2010, 6:53am
 
You could also try System.err.println()
Re: println() from application?
Reply #3 - Jun 17th, 2010, 1:46pm
 
Thanks both for your suggestions, but I finally got it figured out.  I don't know if it's something wrong on my pc or what, but using a simple . for classpath wasn't expanding.  Changed it to ./* and all is working.  Smiley

Now just takes "java NameOfSketch" to run from the /lib folder. (as it should)

fwiw, using -cp (or -classpath) ./* on command line didn't work, but setting same as env var does, so i'm happy enough, i think my system is just a bit wonky
Page Index Toggle Pages: 1