Is there a way to run short bits of Java code without compiling?

后端 未结 9 1418
無奈伤痛
無奈伤痛 2020-12-25 15:33

Is there a way to run or simulate running Java statements (kind of like IDLE - the Python GUI) without compiling and running the executable? I want to quickly test statement

9条回答
  •  情书的邮戳
    2020-12-25 15:53

    Using Eclipse, you can create a Scrapbook page which will allow you to do exactly this.

    Caveats:

    1. You need to use full binary class names for anything outside of java.lang
    2. You need to select the code (standard text selection) that you want to run
    3. There are three different methods for running -- Inspect, Display, and Run. Inspect and Display are virtually the same, showing you the result of the last statement in your code (so you don't need to print it or anything), Run runs the selected code and dumps any output to the console view.

提交回复
热议问题