I have created a console based jar program. To be able to run it with jarfile.jar
or by clicking on it, I went into the registry editor and edited HKEY_CLASSES_ROOT > jarfile > shell > open > command > (Default) from [...]javaw.exe[...]
to [...]java.exe[...]
. It worked, but not immediately - I had to change default program and then change it back a couple of times and do a lot with it (I don't remember exactly). There are two drawbacks to this method: one, executable jar files that aren't meant to be run with console will now have one and that's kind of annoying; two, if I want to release this program publicly, everyone who wants to use it will have to do the same thing or run it with
java -jar jarfile.jar
.
Therefore, I'm wondering if there's a way to edit the jar's main class to open its own console window that won't be blocked by javaw.exe, so that I can run the jar file with javaw. I'm thinking something like openConsoleWindow(); outputTo(theNewWindow()); inputFrom(theNewWindow());