Java Scrapbook for NetBeans IDE
By Geertjan on Aug 20, 2013
In a couple of NetBeans discussions and issues, users are asking for a Java scrapbook feature:
I took Jesse Glick's Scrapbook feature, mentioned at the end of the issue above, included Java code templates, coloring, and other features, and have made it available as a plugin in the Plugin Portal:
After you install it in NetBeans IDE 7.3.1 or above, create a new Java project (Java SE, or EE, or whatever, so long as the project has a Java classpath). The feature lets you keep track of sample code snippets, which are stored in a scrapbook file in the 'private' folder of your NetBeans project and when you run them, after right-clicking in the editor, they are executed against the project's classpath.
So, you first need to create a Java project, since the classpath from the project is used when you run the snippet:
Then the editor opens and you can use quite a few of the Java editing features, but not code completion, to write some snippets:
By default, i.e., if you select nothing in the editor, when you right-click and choose "Run Snippet" everything in the editor is run. However, if you have something selected, e.g., the whole of line 7 above, then only that line will be run. In other words, you can run blocks of code.
Similar plugins, though they don't let you run code:
Interested to know how useful this feature is considered to be! Ultimately, maybe something to include in NetBeans IDE?