B4J Question Capture stdout

Pascual Pérez

Member
Licensed User
Longtime User
In my application i call a method of a class in a file included with #AdditionalJar. This method produces an output to stdout. Is there some way to capture stdout, or at least redirect stdout to a file?
Sorry for my bad english, thanks.
 

Pascual Pérez

Member
Licensed User
Longtime User
Seeing how it can be done in Java, i found a solution in B4J (for redirecting to a file):

B4X:
dim system, printstream as JavaObject
system.InitializeStatic("java.lang.System")
printstream.InitializeNewInstance("java.io.PrintStream", array as Object("STDOUT.txt"))
system.RunMethod("setOut", array as Object(printstream))
 
Upvote 0
Top