How To: Read compiler console output?
Hi,
I am creating a plugin for IntelliJ that will create a teaching environment for Java. A core part of this will be exercises that are completed by the student, run, and the output of the process then read and further action is taken.
I have managed to get output reading working through this post: https://intellij-support.jetbrains.com/hc/en-us/community/posts/203361530-Read-text-from-Run-window, which also mentions getting compiler output. I will need this to display suggestions for fixes to the student. The solution in the linked post is outdated and I cannot find the classes needed to implement it, so I presume they have been removed.
What is the correct way to do this in the current version of IntelliJ?
Many thanks in advance!
Please sign in to leave a comment.
Just to add something: in this post (https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000096950-Get-current-console-output-to-work-with) the last comment describes a problem that the console output is only available on the second run of the program. I am also having this issue. I can provide any details necessary, I'd be very grateful for any help in solving this one too!
Edit: It seems it's not consistently the 2nd time, but instead just doesn't get the output very consistently..
Could you please be more specific? What is "current version" your're targeting and what classes are missing exactly? Did you add required dependency on Java plugin (https://blog.jetbrains.com/platform/2019/06/java-functionality-extracted-as-a-plugin/)?
Regarding "doesn't work consistently", please post your code and description of behavior to our bug tracker https://youtrack.jetbrains.com/issues/IDEA, Thanks!