2

I'm running into an issue in NetBeans where the output window only uses one type of line separator (\n), regardless of build platform.

I'm on a windows machine, building for windows machines specifically. As far as I can tell, \r\n is the default line separator for windows, and the java runtime environment (when running my program from the windows console) seems to respect that. However, netbeans seems to explicitly use \n as its line separator in the output window when I'm debugging, so using \r\n (or System.getProperty("line.separator"), for that matter) as the scanner's line seperator is useless for when I need to type something.

What can I do aside from having to remember to change a constant before I publish my program? NetBeans obviously ignores System.setProperty in this case, and NetBeans doesn't seem to support changing the line separator used in the output window.

(A similar question, How to change the line ending used in Netbeans, seemed promising, although providing -J-Dline.separator=CRLF as a startup argument to netbeans did not affect the output window, and the show and change line endings plugin only affects files).

Community
  • 1
  • 1
gcode
  • 2,954
  • 4
  • 21
  • 32
  • Is there a particular API that you're experiencing difficulty with? In general Java will will work with either \r\n or \n regardless of what platform its running on. – BillRobertson42 Aug 19 '12 at 16:31
  • I think the answer you may be looking for is the scanner API. The issue occurs when I try to get user input (from System.in), and I have to modify the scanner's delimiter to properly read in input. Now, I would normally be ok with that, because I was only expecting to change it once (so that the only delimiter was the line separator), although the fact that NetBeans uses a different line separator than windows bothers me. – gcode Aug 19 '12 at 20:19

1 Answers1

1

Go to Project Properties -> Run -> Console Type and choose "Standard Output"

Worked for me and might work for you.

m12lrpv
  • 997
  • 2
  • 11
  • 18