use write instead of println. and flush the writer.