9

Is there a plugin in eclipse where can type in a quick java code sample and run it? I remember seeing something like this a long time ago.

Gerrie
  • 3,873
  • 4
  • 23
  • 26
  • See also http://stackoverflow.com/questions/237987/storing-code-snippets-in-eclipse/238042#238042 or http://stackoverflow.com/questions/529391/eclipse-compiling-executing-program/531339#531339 – VonC Feb 01 '11 at 12:27
  • @VonC Sometimes not knowing what something is called, causes you to not find the right answers. Scrapbook whas this one. – Gerrie Feb 01 '11 at 12:46

1 Answers1

13

You can use the Scrapbook:

enter image description here

You need to explicitly reference all class files using a full package name, but you can get around this by importing all the libraries (including the JRE libraries) you need onto the runtime classpath.

Joel
  • 29,538
  • 35
  • 110
  • 138
  • Thanks, for those who are looking for more detail, its under File > New > other > Java > Java Run/Debug. Select a parent project and type a name for the scriptlet. Just above it there is a function to run it. – Gerrie Feb 01 '11 at 11:12