running the command is easily done.. just use the /run command
However, getting the information from the window can be more difficult.
You might try redirecting the output to a file, then read from the file.
To redirect the output to a file use
/run java MyJavaFile > file.txt
Above code is an example only.