Java system.out.println and \n problem

I thought I put this one so people don’t have to spend the time I did troubleshooting this.

I have a simple java schedule agent running on the server that output status messages to the server console. For example,

system.out.println(“checking status…\n”);

system.out.println(“status is ok…\n”);

After upgrading to R7.0.2FP1 from R6.5.5 it stop working! In R6.5.5 I had to put “\n” so it puts a linefeeds to make messages more readable. But, in R7.0.2FP1 if I have “\n” at the end then it won’t output anything. Not sure if this is by design or not. But, without the “\n” it now put the linefeed automatically. So, after revising the code to

system.out.println(“checking status…”);

system.out.println(“status is ok…”);

then it starts displaying properly. It for some reason now does not like “\n” at the end.

I hope this entry will save you time if you run accross this problem.

Subject: java system.out.println and \n problem

That’s the difference between System.out.print and System.out.println. println ends witha Carriage Return, print does not.

Shawn

Subject: RE: java system.out.println and \n problem

Sorry, I meant

System.out.print(“…”)

It used to work with “\n”, but now I have to remove it otherwise it won’t show anything.