you are not creating a compiler, you're creating a program that tries to call a compiler someone else created.
The reason your output is not retained is likely because you're launching another process which under Windows means another command shell, which gets closed as soon as that process completes.
And all that when you don't have to create another process at all, but can run any public method in any Java class from any method in any other Java class as long as the class you want to access is on the classpath.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.