How to execute console or GUI input as if it was actual Java code?

前端 未结 4 939
眼角桃花
眼角桃花 2021-01-21 08:37

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

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-21 09:21

    You can use JavaCompiler, as this question's answer states:

    https://stackoverflow.com/a/935316/420001

    Also, what you're wanting to do is evaluate a String of code:

    It's not really recommended though.

提交回复
热议问题