java - Mac Jar Launcher does not wait for input -
(first question bear me)
i'm new java, , i'm trying create executable .jar file. can run .jar through terminal, when double click .jar in finder, doesn't seem want open. when check console errors, looks program runs, skips right on have user input , moves right through code.
here's code skips over
private string readinputline() { string line = ""; system.out.println("\n>>"); try { bufferedreader reader = new bufferedreader(new inputstreamreader(system.in)); line = reader.readline(); } catch(java.io.ioexception exc) { system.out.println ("read error: " + exc.getmessage()); } return line; }
any appreciated! if matters, i'm on snow leopard 10.6.8.
if want user interact program providing input, , don't want user have run program through command line this:
java -jar /path/to/java/program.jar
if ok, great! can stop reading here. if want use window read on.
then best bet use jtextfield
inside of jframe
. there tons of tutorials on how this, 1 such tutorial (or question guess) can found here. in addition here awesome tutorial on how use text areas in general. hope helps.
Comments
Post a Comment