Server Console input


So for my game, I’m making a server for the multiplayer. Now the way it works, for the console, it uses a cmd window which will display all the output and get the input from the user. For the input I’m using jline, which is better than using a scanner, cause the scanner holds the update loop until gets input. So the way I currently get commands is
[java]try {
setCurrentCommand = new jline.ConsoleReader().readLine();
} catch (IOException e) {

This is fine, cause it lets the update loop keep running, though in my tests I couldn’t get it to take the input. So in the eclipse console, which is the same as the cmd console I typed in helloWorld for example and it should make it through the system and eventually give out a System.out.println(“Hello World”);

Instead the String stays null and never gets my input. So I was wondering if someone could give me an idea how to use jline on server base, inside the update loop, unless I’m going to have to put it on a while statement.

Thanks Sam

Why doing it so complex, after all that library does use the same basica anyway, so learn them ?

in main

try {
			this.cin = new BufferedReader(new InputStreamReader(, java.nio.charset.Charset.defaultCharset().name()));
		} catch (final UnsupportedEncodingException e) {
			this.cin = new BufferedReader(new InputStreamReader(;

in update

private void consoleCommands() { try { if (this.cin.ready()) { final String line = this.cin.readLine(); final String[] lines = line.split(" "); this.processCommand(lines); } } catch (final IOException e) { e.printStackTrace(); } }