Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Java Development User Guide
Previous Page Home Next Page

Evaluating snippets

In this section, you will evaluate Java expressions using the Java scrapbook. Java scrapbook pages allow you to experiment with Java code fragments before putting them in your program.

  1. In the File menu select New > Other > Java > Java Run/Debug > Scrapbook Page. You will be prompted for a folder destination for the page.

    Create Java Scrapbook Page wizard

  2. In the Enter or select the folder field, type or browse below to select the JUnit project root directory.
  3. In the File name field, type MyScrap
  4. Click Finish when you are done.  A scrapbook page resource is created for you with the jpage file extension.  (The jpage file extension will be added automatically if you do not enter it yourself.)  The scrapbook page opens automatically in an editor.
  5. In the editor, type System.get and then use content assist (Ctrl+Space) to complete the snippet as System.getProperties().

    Content proposals popup

  6. Select the entire line you just typed and select Display from the context menu.  You can also select Display Result of Evaluating Selected Text from the toolbar.

    Snippet editor with System.getProperties() selected showing context menu

  7. When the evaluation completes, the result of the evaluation is displayed and highlighted in the scrapbook page.
  8. You can inspect the result of an evaluation by selecting text and choosing Inspect from the context menu (or selecting Inspect Result of Evaluating Selected Text from the toolbar.)
  9. When you are finished evaluating code snippets in the scrapbook page, you can close the editor.  Save the changes in the page if you want to keep the snippets for future use.

Related concepts
Debugger

Related tasks
Creating a Java scrapbook page
Displaying the result of evaluating anexpression
Inspecting the result of evaluating anexpression

Related reference
New Java Scrapbook Page wizard
Java scrapbook page
Expressions view

Legal eclipse_java_notices


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire