Other Java - System.out.print() problem on Linux

Starchild

Active Member
Licensed User
Longtime User
Has anyone used the System.out.print() function as part of B4J inline code (or a library)?
It is supposed to print text onto a line (without any linefeed).
On windows this is true.

But on Linux it has a trailing linefeed same as the println() function.
So you can't leave the cursor at the end of the same line as the printed text.

I have tested this with OpenJDK11.0.4 and JDK8u192 installed under Ubuntu.
Both have the same problem.

Maybe someone else can do a test to confirm.
B4X:
Public Sub Print(Prompt As String)
    Private nativeMe As JavaObject=Me
    nativeMe.RunMethod("javaPrint",Array(Prompt))
End Sub

#If JAVA
public static void javaPrint(String prompt)
{
    System.out.print(prompt);
}
#End IF

Please let me know.

PS: I tried to lodge a bug report for OpenJDK but can't work out how to do it.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Works fine here:

bA5FJYUjMM.gif


Don't test it with B4J-Bridge as B4J-Bridge redirects the output.

B4X:
Sub AppStart (Args() As String)
   test
   StartMessageLoop
End Sub

Sub test
   Do While True
       Sleep(500)
       Print(".")
   Loop
End Sub

Public Sub Print(Prompt As String)
   Private nativeMe As JavaObject=Me
   nativeMe.RunMethod("javaPrint",Array(Prompt))
End Sub

#If JAVA
public static void javaPrint(String prompt)
{
    System.out.print(prompt);
}
#End IF
 
Upvote 0
Top