Java output file doesnt recognise \n as linebreak
<p>for a Java project for a University Class I have a method that saves ASCII images as a uniline string and another method called toString rebuilds this ASCII image and returns as a string. When I run my program on the Eclipse my output looks on console alright and multiline, and there are line breaks where they should be. But when I run it with the command line with a redirected outputfile </p>

<p>java myprogram &lt; input > output </p>

<p>the text in the output is uniline without line breaks</p>

<p>Here is the code of the method </p>

<pre><code>public String toString(){

    String output = "";

    for(int i=0; i&lt;height; i++){
        output=output+image.substring(i*width, i*width+width)+"\n";

        }
    return output;  
}
</code></pre>

<p>What should I do so I can get a multiline output text file</p>
