If your build system used the Terminus package, then invoking the build would invoke Terminus to run the build which would result in a terminal tab appearing right inside of Sublime to run your program, which you could interact with.
The rule of thumb is that if you can construct a command line in the terminal that does a thing for you, then you can probably make a sublime-build
file do the same thing, since it’s just running some external program with some series of arguments, which is exactly what you’d be doing in the terminal anyway.
A stumbling block to achieving this is that in order to tell Sublime how to run the build you need to know how to do what you want in a terminal already. Java is particularly notorious in this regard just because it’s incredibly sensitive to filenames and file layout (every class has to be in a file with the right name, the locations of the files have to match their locations in the package they’re in, etc).
If you can determine what command you need to run in the Terminal to do this, we can help you set up a build system in Terminus that would do it for you.