Forum Discussion

Buschfunk's avatar
Buschfunk
Frequent Contributor
14 years ago

Reading StdOut for Java applications

Hello,



Using TestComplete 8 I followed this article http://support.smartbear.com/viewarticle/16559 - "Working with Console StdIn and StdOut Streams". This works fine for the given example. However I need to call a runnable JAR like this:



java -jar myApp.jar



This command prints some data to the console using System.out.println(). Using the above sample code does not return the output of the Java application but an empty string. Also "java -version" as a command gives an empty string in TestComplete.



How can I get the output of this Java application?



Sincerely,

Robert

1 Reply

  • Hi Robert,



    Using the approach from the help topic, you can get access to the standard output stream of the java.exe program, not myApp.jar. I'd recommend redirecting standard output of your Java application to something that can be accessed using TestComplete. Some approaches of the redirection can be found in Capturing contents of standard output in Java. For example, if you decide to redirect output to a file, you'll be able to get this output from TestComplete using the techniques from the "Working With Files From Scripts" help topic.