I want to be able to input java commands/code to execute during run-time (during the execution of a \"persistent\" program) in the same way, or as close as possible, to the same
Use the JavaCompiler. It can compile code from a String
.
For an E.G. see the STBC & especially the source code. It provides a GUI and can compile the code in the text area on button click.
But note the:
STBC will run on any computer with a version 1.6+ Java Plug-In* JDK (AKA SDK).
(*) The API that STBC uses is merely a public interface to the compiler in the tools.jar
that is distributed only with JDKs (though the 'public JRE' of the JDK also seems to acquire a tools.jar
). This leads to some unusual requirements in running either the native jar, or the web start app.