Inspect your code in Eclipse using Eclipse Scrapbook feature

The java IDEs (eclipse, IRAD etc) contribute a scrapbook facility that can be used to try and evaluate Java expressions (such as code snippets). Java scrapbook errors are shown in the editor. Snippets are edited and evaluated in the Scrapbook page editor. In the editor you can select a code snippet, evaluate it, and display the result as a string in console.

Creating a Java Scrapbook Page

The scrapbook allows Java expressions, to be run, inspected, and displayed, under the control of the debugger. Exceptions are shown in the scrapbook itself.

A VM is launched for each scrapbook page in which expressions are being evaluated. The first time an expression is evaluated in a scrapbook, a VM is launched. The VM for a page will remain active until the page is closed, terminated explicitly (in the debugger or via the Stop the Evaluation button in the console), or when a System.exit() is evaluated.

  1. From the workbench window, do one of the following:
    • From the drop-down File menu ,click on the New button, select Other. Then select Java ->Java Run/Debug -> Scrapbook Page. Then click Next.
    • Enter any file name.
  2. In the File name field, type a name for the new page. The .jpage extension will be added automatically if you do not type it yourself.
  3. Your jpage is ready to use. You can add java code snippets and select them and run them directly.

eclipse-scrapbook



Leave a Reply

Your email address will not be published. Required fields are marked *

Note

To post source code in comment, use [code language] [/code] tag, for example:

  • [code java] Java source code here [/code]
  • [code html] HTML here [/code]