I have my program in an executable jar, which has output from System.out.println(). However unless someone goes into cmd/terminal and runs it, the output doesn't appear anywhere, even though it's running (making it a lot more difficult to close as well). I was wondering how I could make it open a command prompt window on startup so that the output could always appear, regardless to if it were run in cmd/terminal or if it were just double-clicked.
|
Java
How would I make an executable jar open a command prompt window? |
(Nov 28, 2013 09:45 AM)кovu Wrote: As an alternative to that, you could make it open a JFrame with an info field that you use instead of System.out.println. That sounds like it could work as well. How would I go about doing that? (Nov 28, 2013 09:46 AM)ImportUsername Wrote: That sounds like it could work as well. How would I go about doing that? Make a JFrame, add a label or text field. Then, just .add() to it the system.out.printlns. (Nov 28, 2013 08:36 PM)Manthe Wrote: Thats missing the whole point of having an executable jar. Not really. You are using a bat file to open the executable. That's like saying "using the mouse to double-click and execute it" is missing the whole point of having an executable jar.
Nov 29, 2013 11:17 AM
(This post was last modified: Nov 29, 2013 11:18 AM by Cyllon.)
Runtime.getRuntime().exec("cmd /c start");
I also think you can add "echo" and the text you want, if you place it behind start in the runtime command[/quote] I think its that 🤝 |
|
|


