Eclipse – Unlocking Scrap Page (really powerful)

A scrap page is a small file in which one can try out Java expressions. Yes of-course we can do any crap thing on this page…  🙂

To create a scrap page choose File –> New –> Other –> Java –> Java Run/Debug –> Scrapbook Page , give it a name and select a destination folder and we have our own empty scrap page with .jpage extension.

OR alternatively, New –> Other –> type scrap in the <type filter text> wizard and select Scrapbook Page.

Usage:-

Lets start with traditional Hello World example. Open up scrap page and try Hello World thing. To execute, select the statements and right click and Execute (or Ctrl+U).

 

example1

Now lets try out arraylist example,


String text = "Hello World!! I am a scrap page!!";
System.out.println(text);

java.util.List<Integer> list = new java.util.ArrayList<Integer>();
list.add(1);
list.add(2);
System.out.println(java.util.Arrays.toString(list.toArray())); 

example2

One can also select expression and click on inspect (Ctrl+Shift+I) and display(Ctrl+Shift+D) option of an eclipse.

Try out missing semicolon or any other compilation error, scrap page will stop you…

Scrap page looks pretty promising to do tryouts. However, you need to write fully qualified names instead of importing it.

Have a great weak ahead and enjoy eclipse’s undervalued but extremely powerful feature – The Scrap Page.

Advertisements
Tagged with: ,
Posted in Eclipse
2 comments on “Eclipse – Unlocking Scrap Page (really powerful)
  1. Lohith says:

    nice one dude..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s