Pascual Pérez Member Licensed User Longtime User Feb 12, 2014 #1 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.
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 Feb 12, 2014 #2 Seeing how it can be done in Java, i found a solution in B4J (for redirecting to a file): Code: Copy 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
Seeing how it can be done in Java, i found a solution in B4J (for redirecting to a file): Code: Copy 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))
Erel B4X founder Staff member Licensed User Longtime User Feb 13, 2014 #3 You can also redirect stdout to a file when you launch the application. Code: Copy java -jar file.jar > STDOUT.txt 2>&1 This will redirect all output to the file. Upvote 0
You can also redirect stdout to a file when you launch the application. Code: Copy java -jar file.jar > STDOUT.txt 2>&1 This will redirect all output to the file.
Pascual Pérez Member Licensed User Longtime User Feb 13, 2014 #4 Yes i know, but i want to launch the app "normally". Thank you for your interest. Upvote 0