launching javaw properly from dos
Friday, February 28th, 2003launching javaw properly from dos bat file, and other simple tips. aha, at the bottom of this page on (java) invocation in windows OS there are some tips on launching with and without windows, and how to keep a console around after exit.
I often had a useless console window sticking around after launching a java gui (say logfactor5) from a bat file, or worse, after launching a long-running process (if the console allows you to type into it, you pause the process’s output). I got the javaw bit no problem, but of course my old bat file was waiting to close, because i was invoking javaw directly in the launch bat.
examples: “start cmd /K java” to launch and have the window stay around on exit, to help you debug a fatal error, “start javaw” to let the launching bat file finish, leaving zero windows - for apps that don’t need them.
my logfactor5 startup bat now looks like this - you can roll over the component pieces of the following command to see a description of each as a tooltip: start javaw -cp %cp% \ org.apache.log4j.lf5.StartLogFactor5 %1
Very much the sort of idiot-slow discovery I shouldn’t post, but I’ll bury my pride just in case there are other idiots out there.
Of course, you can also start long running java processes as services. wrapper.sourceforge.net looks interesting for this and more, but more work than some of the other java as windows service tools i’ve today stopped being able to find with google.
google search terms were: javaw no “command window”