Lately I've been working on building two tools using Eclipse. I'm printing some messages to the console there (System.out.print
).
However, I've now constructed a .jar file for each tool, which I want to run on a different machine (no eclipse installed). Running this .jar does not provide me with the messages I'm printing.
What is the best way to print messages to the screen from a running .jar file? For example, how to print:
System.out.print("Results succesfully saved!");
I've googled quite a bit, but couldn't find any results.
System.out.print("Results succesfully saved!");
will work just as fine for a .jar-program. However, it requires the user to run it in a terminal so that he sees the stuff printed to standard output.
If this is not what you're after, then perhaps you want to have a look at JOptionPane
which has a few static methods to graphically display messages like those.
This screenshot
is for instance produced by this snippet:
import javax.swing.JOptionPane;
class Test {
public static void main(String[] args) {
JOptionPane.showMessageDialog(null, "Results succesfully saved!");
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With