Monday May 11, 2015

Selecting Content Between Braces with Ctrl-Shift-[

The question of the day comes from my colleague JB Brock who asks: "Is there some key combination (shortcut) in NetBeans that allows me to jump between an opening brace and closing brace, or even better, the ability to select everything between braces? I'm working in a JSON file and want to select a full object between { } braces.  Just looking to see if there is something that could make my life a little easier as I have 105 of these little sections that I need to strip out."

Here's how to do it. Below, notice that my cursor is on line 6, right before the opening brace, which means that its closing brace is helpfully highlighted so that you know which brace is the current opening brace's closing brace:

Now I press Ctrl-Shift-[ and this is the result:

Now you can press Ctrl-C to copy the selection to the clipboard.

In the next scenario, notice that my cursor is still in line 6, this time on the other side of the opening brace:

When I press Ctrl-Shift-[ in the above scenario, the selection covers everything excluding the opening and closing brace:

Now, again, press Ctrl-C and the content above is on the clipboard.

The above works in any other kind of file, as well, e.g., in Java, JavaScript, HTML, etc., which is precisely why it is great to have an integrated development environment—everything you know from one context has the potential to seamlessly be used in another context.

Thursday May 07, 2015

AspectJ and NetBeans IDE 8.0.2

Here's a very nice YouTube screencast created over the last day or two by Valhalla Data Systems about AspectJ support in NetBeans IDE 8.0.2.

Wednesday May 06, 2015


Spectingular is ING's AngularJS-based framework. Here's a fully automated way of getting started with it.

1. Create a new HTML5 application:

2. Use Bower to add Spectingular:

3. Drag-and-drop Spectingular.js into your index.html file:

That's it. You've added Spectingular to your application. 

Tuesday May 05, 2015

Where are the slides from the NetBeans Days?

NetBeans Days are happening all over the world.

"Oh, really, why aren't they happening in my country?" you ask. "Well, that's because I myself haven't set one up yet!" is how you should answer that question to yourself.

The slides are stored centrally in the above location (more will be added from previous and future NetBeans Days over time) and will be from hereon onwards! 

Monday May 04, 2015

Free New NetBeans Plugin Development Workshops

A start was made at a NetBeans plugin training session with members of the Nagpur JUG in India, as well as others in Pune, over the weekend.

Aatul Palandurkar, who leads the JUG, and who is a NetBeans Dream Team member, set up the session, and took the pic below.

Skype ended up being a bit of a problem and the plan is to have a larger session via Google+, together with the Oracle Technology Network.

If you're interested in free NetBeans plugin development workshops, to integrate your tools, frameworks, and technologies into NetBeans IDE, leave a message here or drop me a mail (at geertjan dot wielenga at oracle dot com). Note that these workshops are specifically focused on extending NetBeans IDE, not on creating your own applications on the NetBeans Platform.

Friday May 01, 2015

Eclipse Recommenders for NetBeans IDE (Part 1)

Wouldn't it be handy to know how other developers have used the Java API that you're learning about? Imagine that you're learning about java.util.List, you invoke code completion in your Java editor, and you see that 31.84% of users of the List class have used iterator() and, most usefully of all, that the most widely used methods on the List class were to be found right at the top of the code completion box, as shown below, in NetBeans IDE? Even if you're not learning about an API, instead you're using it in your daily development work, it's handy to have the most widely used methods of an API listed at the top of the code completion box.

Welcome to the world of Eclipse Code Recommenders.

Marcel Bruch, who leads this project, has a bunch of slides explaining it all here:

The obvious question is how those percentages are calculated. Marcel tells me: "We use example applications from the Eclipse Marketplace, Maven Central, and other public Maven repositories to build recommendation models. There is also a crowdsourcing approach in place where developers share their knowledge how they use these APIs. For companies, we use in-house code repositories like Nexus or VCS like SVN, Git etc."

Right now only JDK classes are available by default, i.e., if you call up code completion on some class that is not in the JDK, you will not get recommendations. I asked Marcel about that, i.e., "How can new libraries be added, right now only JDK libraries are included", and his response: "We're currently setting up co-operation with other companies to support models for other public frameworks. Primary focus will be on Java EE standard classes and Apache libraries."

A related question I had is how come the percentages add up to over 100%. His response: "The percentage says how likely it is that you will call a given method in your code. If you must call two methods, both methods will have 100%. Same with overrides—if you subclass a type and have to override two methods in there, both will have 100%."

If you'd like to try out these concepts in NetBeans IDE, there's an Update Center by Jan Lahoda that you can register in Tools | Plugins to install the plugins that provides this feature:

On GitHub:

Thursday Apr 30, 2015

Future Proof NetBeans IDE: Filter Out JavaScript Parser Errors

Yes, it's a crazy, crazy world, with each day so full of JavaScript.

React.js is the cool kid of the hour and, of course, in terms of end-to-end tooling, NetBeans IDE is great. In other words, you can set up your React.js application in seconds (and forget the command line completely), use Bower and NPM with it easily, you can debug it, run it into the browser, interact with it live in the browser, wrap it into a native Android or iOS app via integrated Cordova tooling, deploy to Android and iOS, etc etc etc. And all for free!

However, each of these new JavaScript frameworks comes with their own special (some might say "squirly") addition to the syntax of JavaScript, which breaks the editor, as shown below, i.e., click to enlarge the screenshot and then look at the error marks:

That makes the editor unusable for React.js and for whatever new JavaScript framework pops up over night to claim the "we are the coolest JavaScript framework in town" prize of the moment. Rather than running after each and every framework and providing tools for it and then finding that by the time the tools are released no one cares about the framework anymore, a simple solution is to let the user turn off the error marks in the JavaScript editor:

Here's how it works, from the next release onwards, and already in development builds, i.e., not in NetBeans IDE 8.0.2, but in the next release. You'll simply click on one of the yellow lightbulbs and then NetBeans will offer a scope within which the error parsing should be disabled:

Right now, the above will result in the below:

Notice that there are still some error underlines, though everything else has been filtered out, which is being tracked here:

Onwards to a future proof NetBeans IDE!

Wednesday Apr 29, 2015

Node.js Express App in NetBeans IDE

The Visual Studio tutorial "Developing Node Applications" is... all about using the command line to set up a Node application. Here's the NetBeans IDE equivalent (using a development build, i.e., this is not in NetBeans IDE 8.0.2) of at least the first half of that tutorial, in screenshots, i.e., the whole process is automated, which is the point of tooling, i.e., to provide automation.

Click Finish after the above steps and you have a complete Express application, exactly the same as described in the Visual Studio tutorial above.

Then run it and you can use the many supporting tools in the IDE to tinker further with your application:

Monday Apr 27, 2015

Less Noisy NetBeans

Especially when you've tuned NetBeans to make it dark, it's helpful to be able to remove as much noise as possible. Spend less than 3 minutes learning how to do this!

Sunday Apr 26, 2015

YouTube: How to Setup and Use Minecraft Forge

Quite impressed by Minecraft Forge, as well as how well it integrates via the Gradle plugin into NetBeans IDE:

Saturday Apr 25, 2015

Seamless Minecraft Forge in NetBeans

Minecraft Forge is a common open source API focused on allowing mods to be created without the need for the source code of Minecraft to be edited. 

Happy to report that Minecraft Forge works seamlessly in NetBeans IDE. Take the following steps:

  1. Download and unzip Forge 1.8 from

  2. In the folder where you unzipped the above, run "gradlew setupDecompWorkspace --refresh-dependencies".

  3. Start NetBeans IDE (I am using NetBeans IDE 8.0.2). Go to Tools | Plugins and install "Gradle Support".

  4. Go to File | Open Project. Browse to the folder where you unzipped the above, which will now be recognized as a Gradle project. Open the project. Wait a moment for the Gradle plugin in NetBeans IDE to figure out the structure of the Gradle project you have opened.

  5. Right-click the Gradle project and go to Tasks | run | runClient. After a moment, Minecraft starts up!

Illustrative screenshot, click to enlarge it:

Next, you'll want to map the "runClient" task to the "Run Project" command in NetBeans IDE, so that running your mods is as simple as pressing F6. Right-click the project and choose Properties. The Project Properties dialog opens:

Click "Manage Built-In Tasks" above. Now look for "Run" and then type "runClient" in the Tasks field, as shown below:

Click OK. Press F6 (which is mapped by default to "Run Project") and the "runClient" task will be run! 

Congratulations to Attila Kelemen from Hungary, for making such a nice NetBeans plugin for Gradle. 

Now mod away

Friday Apr 24, 2015

Nashorn from the Perspective of the Java EE Developer

What is it that's interesting about Nashorn, which is now built into Java 8, for a Java EE developer?

Adam Bien's response:

First, Nashorn is just JavaScript in Java 8. A very fast one and very well integrated with Java. For a Java EE developer, the first interesting thing is automation. For instance, yesterday I had to find some problems in my log files, so I built a quick parser with Nashorn and Java 8, and it was a very pragmatic solution, it took me 20 minutes, and it was ready to go. Then, you know, deployment, starting servers. You can use Nashorn as a system scripting language, which is very very convenient. This is the most obvious and, I would say, least intrusive usage of Nashorn. Then, of course, you can embed Nashorn into your application. What you gain from that—flexible checks, validation rules, algorithms. It is easier to use Nashorn than to write your own parsers, for instance. And what you can also do, of course, is use Nashorn to start Java. One example would be—I created an integration solution where you can very easily map, via JavaScript, input to output, and be able to read a database and output it to Excel, without recompiling the solution, for instance. Wherever you need flexibility and you don't want to redeploy the application, Nashorn might be the right answer.

From a recent interview by Coman Hamilton (from JAX) with Adam Bien, here on YouTube

Thursday Apr 23, 2015

Porting Knockout.js Examples to DukeScript

I hold this truth to be self-evident—a technology without samples is doomed to failure.

Better still is to have examples that relate to something that your target audience is already familiar with.

In the case of the Knockout.js community, these are the samples that everyone knows:

And... here are the DukeScript equivalents, in progress, most are already there, while others are still being worked on:

Feel free to clone them, change them, enhance them, and use them as the basis of your own applications. Notice, in particular, that all the coding you'll do is in Java and not in JavaScript! 

Wednesday Apr 22, 2015

New Spring Boot Integration for NetBeans IDE

Aggelos Karalias, one of the attendees at NetBeans Day Greece, has made a brilliant plugin for NetBeans IDE that provides code completion for Spring Boot configuration properties, click to enlarge the screenshot below:

Congrats, Aggelos! (And great to have met you in Greece!) As you can see above, it works perfectly.

I checked out the sources here, built, and installed them:

And then I used this project by Michael Simons, to make the screenshot above:

Also, this article is useful about Spring Boot and NetBeans, as well as other technologies, such as AngularJS:

Tuesday Apr 21, 2015

Mapping Knockout.js Concepts to Java

Here's a table that should help you when expressing your JavaScript-based Knockout.js applications in Java via DukeScript.

Knockout.js DukeScript Example
Observable property @Property
@Property(name = "itemToAdd", type = String.class)
Observable array property @Property with 'array' attribute
@Property(name = "items", type = String.class, array = true)
Computed property @ComputedProperty
static String fullName(String firstName, String lastName) {
    return firstName + " " + lastName;
Function @Function
static void addItem(Data model) {
    String itemToAdd = model.getItemToAdd();
    List items = model.getItems();
    if (itemToAdd!=null&&itemToAdd.length()>0){

Want to see the above in action? Watch this new screencast created today:

Monday Apr 20, 2015

Hello, Knockout.js Users Everywhere!

Are you interested in increasing the scope of adoption of Knockout.js? If so, you should be interested in the screencast below, which shows you how the Java community can use Knockout.js, without needing to code in JavaScript. After all, the Java community can benefit a lot from the two-way databindings provided by Knockout.js but is prevented from doing so by needing to switch to a different language for coding in Knockout.js. At the same time, there may also be a segment of the Knockout.js community that in retrospect prefers Java over JavaScript and might by means of the below remain within the Knockout.js community thanks to the possibility of using Java.

Either way, enabling your technology to be exposed to the Java community is surely a big win! 

In short, watch this new screencast, created today!

Sunday Apr 19, 2015

YouTube: NetBeans Days Greece (in 3 Minutes)

The first of many more NetBeans Days in Greece came to an end yesterday... and here's a 3 minute impression of the event, with many thanks to Mark Stephens from IDR Solutions (with a trip report here) for recording the interviews:

Thanks to John Kostaras from JCrete for organizing and also speaking, as well as Emmanuel Hugonnet from Red Hat, Mark Stephens from IDR Solutions, Vasilis Souvatzis with his first ever presentation at a conference, and Jaroslav Tulach, founder and initial architect of NetBeans. 

Also a BIG shout out to the Anderson Software Group for sponsoring the event. Thanks Paul and Gail, we promoted your organization and books and everyone applauded on hearing of your support for this event!

Saturday Apr 18, 2015

Contact List in DukeScript

Here's a small Contact List app, created in DukeScript, with a bit of help from Jaroslav Tulach. It is shown below running in the browser on my desktop, as well as in the JavaFX WebView:

Here's the sources, unzip them, you'll have Maven projects to work with. 

I don't have Android setup and no Mac OSX available, so I didn't include the related Maven projects for those devices. 

Soon I will blog about the code used in this example and make a screencast about it. 

Friday Apr 17, 2015

Java in the Trenches

Java has been driven into the trenches, some years ago already. (Slightly under hundred years after the photo on the left was taken, in 1914.)

More or less the general consensus appears to be that the frontend battle has been won by JavaScript.

So, what's the role for Java in this brave new world? More or less the general consensus appears to be that Java has great value on the backend. The Java EE Platform is awesome in that it consists of specifications agreed upon across the industry, whereas the JavaScript ecosystem is crazy mad cowboy land.

However, what happens when those frontend developers, who have, without any resistance, moved to JavaScript, discover the value of Node.js over the value of the Java EE Platform? What happens when they see the value of doing the frontend and the backend in the same language, i.e., JavaScript? What happens when they rate that value higher than the value of the industry-based specification-approach promised by the Java EE Platform? When the value of an agreed upon industry-wide platform, i.e., the Java EE Platform, weighs less than the value of having a common programming model right across the application, from its front to its back... then what happens? Java will have no place in the browser and will be pushed back further still, into the purely scientific world, focused narrowly on simulation software, relevant to back-office banking and defense force software, that is, desktop solutions and console solutions, only, where the NetBeans Platform is the purest Java solution, in terms of application framework. It will then be competing with Cobol and AS/400 RPG and their various other crusty friends. 

It's hard, but let's be honest. 

What is to be done? Instead of giving up on the frontend and retreating to the backend, from which a further retreat will inevitably follow, into obscurity, the frontend should be defended, simply because the Java ecosystem is so much better than the JavaScript ecosystem, as Java developers know, by Java developers. How? By means of DukeScript.

Thursday Apr 16, 2015

Best NetBeans IDE Tweet, Ever!

The point here is the NetBeans is not only an IDE, with the 'heaviness' that the term tends to imply. It is also a text editor, a direct competitor to tools like Sublime, once you discover the Favorites window that enables you to work with individual files, instead of projects:


Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« July 2015