How to get carriage return without line feed effect in Eclipse console?

Solution 1:

As Nishant already pointed out in the comments, you've found a bug here.

This bug initially was reported in 2004 (>9 years ago!?!!) and this bug seems not to be fixed very soon (or ever). I tested it on several Eclipse version, even on Eclipse Juno SR2, and the bug is still there.

Solution 2:

The bug is fixed by now (Eclipse 2020-03). Just go to

Window ➺ Preferences ➺ Run/Debug ➺ Console

and make sure that both checkboxes

Interpret ASCII control characters

and

Interpret Carriage Return (\r) as control character

are enabled.

Solution 3:

It finally seems to be fixed in Mars!

Version: Mars Release (4.5.0)
Build id: 20150621-1200
Used Java: jre1.8.0_60

Your code

public class Main {

    public static void main(String[] args) {
        System.out.print("something\r");
        System.out.print(" any\r");
    }
}

Output

 anything