Inspect your code in Eclipse using Eclipse Scrapbook feature
- By Kiran Hegde on May 20, 2009
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.
- 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.
- 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.
- Your jpage is ready to use. You can add java code snippets and select them and run them directly.
Get our Articles via Email. Enter your email address.