Thursday Feb 12, 2015

Presentation: "This is NetBeans!"

Anyone out there wanting to introduce NetBeans to your organization, university, college, school, or, why not, your family?

Here's a presentation that is pretty comprehensive to help you (the demos will be recorded and on YouTube soon):

Monday Feb 09, 2015

Extending the JavaScript Editor in NetBeans

Just about every other week, it seems like there's a new JavaScript framework out there. Each comes with their own idioms and constructs. When it comes to tools, the only logical way to be able to support the innovation in the JavaScript space is to have a modular, pluggable solution. When you look at the sources of NetBeans, you'll see that its top level structure implies a modular design:

What can we learn about the extensibility of the JavaScript editor by looking into the highlighted modules above? How hard is it to create a new module that provides support for some other JavaScript framework that isn't supported yet in NetBeans?

Let's look at each of the highlighted modules above and learn from them.


Take a look at the 'javascript2.prototypejs' module, shown above, and in more detail below, and you'll see it contains nothing more than one class:

That module is a direct result of this issue: and uses @FunctionInterceptor.Registration.

To see what that single class provides, take a look at how a Prototype sample looked in NetBeans IDE 8.0:

Specifically, look in the Navigator window above, which is not very expressive, compared to the Navigator in the screenshot below, which I took in NetBeans IDE 8.0.2:


The 'javascript2.extjs' module is more complex:

Here's part of the code completion that you see implemented via the code completion classes above:

In the 'model' package of the 'javascript2.extjs' module, the functionality provided is comparable to that provided by 'javascript2.prototypejs' module, which is the Navigator structure shown below (click to enlarge the image):

See this tutorial for step by step instructions to create the sample shown in the screenshot above:


In 'javascript2.requirejs', you can see that the HTML editor can be extended as well:

And you can see part of the above in action here:

The other modules are certainly more complex than the above though, the point is, supporting a new JavaScript framework is not necessarily a complex task.

Here are the annotations relevant to JavaScript extension points, more on these to come in future blog entries:

  • @CompletionProvider.Registration
  • @DeclarationFinder.Registration
  • @FunctionInterceptor.Registration
  • @ModelInterceptor.Registration
  • @ObjectInterceptor.Registration
  • @TypeDisplayNameConvertor.Registration

Saturday Feb 07, 2015

React.js and NetBeans IDE

I tried some small experiments with React.js in NetBeans IDE today. It more or less works and NetBeans IDE is certainly a productive environment for React.js:

I set up JSX from the command line to watch my 'js' folder and push to the 'build' folder: 

From the above, it would appear that JSX is like SASS, i.e., it takes one file and generates another file from it, so creating support for it in NetBeans IDE it could be based on SASS integration in NetBeans IDE. 

In the Options window, I tweaked the Error category for JavaScript files so that red error lines aren't shown in the editor (the red error marks aren't a problem, though the red error lines make the code unusable) because the background of my Error category is more or less the same as the background of the editor: 

I'm looking into creating an editor that understands (no error messages) and supports (embeds HTML syntax coloring and code completion) for files that make use of React.js. 

Friday Feb 06, 2015

Takari: Maven Incremental Build

Add this to your POM:


Make sure you're using Maven 3.2.1 or above. Click to enlarge the image: 


Thursday Feb 05, 2015

Trip Report: Topicus

I had a great time introducing NetBeans IDE at Topicus, which does software development in Deventer, in the Netherlands. To the outside geeky world they're primarily known as the home of Wicket.

The group consisted of about 20 developers and looked like this:

To me, the session was an opportunity for me to warm up for NetBeans Day Netherlands (still seats available, sign up!), which will take place one week from now, and where I'll do a series of demos at the start of the day, making use of these slides, which I created for the Topicus session:

Here's the main pieces of the technology stack used at Topicus:

  • Wicket
  • Maven
  • WildFly
  • Hibernate
  • Spring
  • Ember.js

They're increasingly moving away from Spring, and towards Java EE, have considered GlassFish/EclipseLink, and are now going for WildFly/Hibernate, and are going to move their front end towards Ember.js, though they don't seem 100% committed to that, though they do want a responsive client-side front-end, on top of a Java EE back-end using REST, of some flavor or other.

That's pretty much a standard scenario, I believe, in the Java ecosystem. They like Eclipse for its incremental compilation, while they dislike it for its Maven integration. Their setup didn't work in IntelliJ IDEA, and they're wondering why they should pay for something that has free competitors of similar quality, while they find NetBeans interesting for its Maven integration, but they don't like the performance of native Maven, which Eclipse avoids via its incremental compilations. Also since Maven is partly under pressure from the new world of Gradle, I'm hoping that the incremental compilation problem can be handled via Maven, thanks to, at some point, while the usage of JRebel by Topicus mitigates these problems to some extent.

Anyway, it was a great afternoon/evening and it must be wonderful to work in a company where there's a pizza oven in the backyard. Thanks, Martijn Dashorst, for organizing the event, and also because now I have several new topics to investigate and blog about!

Tuesday Feb 03, 2015

Greenfoot and NetBeans

When I met with Michael Kölling, from BlueJ and Greenfoot, when we discussed the relationship between those tools and NetBeans, Michael pointed out that BlueJ users are closer to NetBeans IDE than Greenfoot users. I took copious notes of our discussion, especially on the differences between BlueJ and Greenfoot, since that difference has never been completely clear to me. As Michael explained it to me: "BlueJ visualizes program structures and their execution, while Greenfoot uses visualization as the input to the program."

"Today we're building a game," is the angle teachers with Greenfoot in the classroom use, rather than "today we're going to learn about object orientation". Clearly, the two tools, though built on the same framework, have different approaches, with "motivation first" being the approach applicable to Greenfoot. It doesn't try to be as complete and formal as BlueJ and it's not a general IDE, while BlueJ is for teaching full programming. Anything in Java you can do in BlueJ, including Java 8. On the other hand, Greenfoot is just for two dimensional graphics, i.e., a very specific domain. Many programs you would never make in Greenfoot; it sacrificises generality for one thing only, to raise interest in programming. Then, after that, you potentially, assuming Greenfoot has raised your interest, go somewhere else to become a real programmer.

The underlying reasoning for Greenfoot came about upon the discovery that, increasingly, the first contact people have with programming is before university or technical college. Long before that, you've normally already decided whether programming is "for you". To "catch them early", the insight was that you need to enthuse people in the early stages of their development, i.e., you need to go to schools.

Anyway, all that having been said, let's see what it takes to take a Greenfoot project and work with it in NetBeans. It's less intuitive than BlueJ (as described here) but Michael and I worked through a process that works. My plan is to make a NetBeans plugin for converting a newly opened Greenfoot project in NetBeans to being a project that does step 2, 3, and 4 below automatically:

  1. Import Java Source Files. Use the 'Java Project with Existing Sources' wizard in NetBeans to import the Java source files created in Greenfoot, same as for BlueJ.

  2. Configure Classpath. Add the two JARs, greenfoot.jar and bluejcore.jar, from the Greenfoot distribution, to the classpath of the NetBeans project.

  3. Set NetBeans Project Properties. Set the main method to 'greenfoot.export.GreenfootScenarioMain' and set the working directory to point to the location of the sources. Click to enlarge the image below.

  4. Set Greenfoot Project Properties. Create a '' file in the 'default package', with properties such as 'main.class' and '':
    controls.runonce.shortDescription=Call 'act' once for every actor.
    run.simulation=Run the simulation.
    controls.reset.shortDescription=Reset the simulation.

  5. Figure Out Images and Resources. Images and resources aren't found automatically. Either put all images and resources into the default package or add 'setImage' method to the classes where images are used and do the same for the resources. Possibly something needs to change within the Greenfoot code to find the images and resources automatically when the Greenfoot JAR is used in standalone mode.

The whole project, here the 'Boids' project, looks something like this:

When you run it from NetBeans, you should see this, which is exactly what you see when you run it from Greenfoot. Take note of some of the properties shown above in step 4, which are applied to the viewer, e.g., the buttons you see in the lower part below:

As you can see from the above, a bit of tweaking must be done, which is why I think a small NetBeans plugin that does the above automatically would be helpful, i.e., what's needed is a "Greenfoot" tab in the Project Properties dialog of Java SE projects, which will let the user specify the above items to be added to the project and configure the project automatically to smoothen the transition from Greenfoot to NetBeans.

Something like this:


Note: See part 2 for enhancements to the above procedure.

Monday Feb 02, 2015

YouTube: Yeoman in NetBeans IDE

Here's a quick overview of the planned workflow for Yeoman in NetBeans IDE.

The sources are here and anyone is more than welcome to clone them:

Saturday Jan 31, 2015

Thanks, BlueJ: Code Outline for NetBeans

And this is why open source software, and the community around it, is so awesome—yesterday I spent some hours with Michael Kölling (read his Wikipedia entry here) while he was visiting here in Amsterdam, who explained to me (aside from many other things we discussed) that BlueJ and NetBeans work together very smoothly and that no plugins are needed for interacting between these tools.

That was great to hear, so as soon as I got home I tried it out. He was right. I made a movie about it and posted it on YouTube:

You'd think that that was "all", maybe, and that I'd end here by saying, "pretty cool, isn't it, how these tools work together and how different projects can strengthen each other, and how cool it is to meet enthusiastic leaders of the open source movement like Michael Kölling".

But there's more to this story! Benno Markiewicz, who is the most prolific NetBeans plugin developer over many years now, and who lives in Leipzig, Germany, saw the movie above today and... saw that BlueJ has a great Code Outline feature, which you can see vertically along the right side below which you can scroll up and down as a bird's eye view of your code:

And NetBeans doesn't have that feature, as discussed in this issue:

As you can see, various tools already have that feature, including BlueJ. Benno wrote today to say: "Because BlueJ's code is not so complex and is based on Swing too, I could extract the relevant classes from BlueJ, deleted some lines of code, and created a NetBeans module using them."

Here's the result (click to enlarge the image to see the whole context):

Get it here, where you can also see how to use it:

More features can be added to it, in time, but it's great to have this feature now available in NetBeans... all thanks to a chain of events that started yesterday over a coffee in a cafe in Amsterdam!

Friday Jan 30, 2015

NetBeans has Integrated javac from jdk8u40-b22

The 'javac' from the latest JDK, that is, JDK 8 Update 40 b22, is now in NetBeans IDE development builds.

As a result, Lukas Eder should be happy to see sources of jOOQ now look like this in NetBeans (click to enlarge):

(Install the 'Dark Look and Feel Themes' plugin if you want NetBeans to look like the above.)

Instead of this (click to enlarge):

Related issue, thanks Lukas:

Tuesday Jan 27, 2015

Displaying and Processing Yeoman Generators and Commands

Each Yeoman generator, when installed, makes available one or more Yeoman commands. On the command line, you don't run a Yeoman generator, but a command provided by a generator. To make that distinction, the user interface of the Yeoman wizard has been changed a bit:

A generator that is available without having been installed is iconized by means of a green download arrow. When that icon is right-clicked, an Install action can be invoked, which will run "npm install -g generator-xyz" from within NetBeans IDE. Once that has been done, the "yo --help" command will be run again, automatically, to populate the upper view with the newly available Yeoman commands.

When a Yeoman command is selected and Next is clicked, the Yeoman command will be run, via "yo ko:app", or whatever the selected command is. Then the generated application will automatically open in NetBeans IDE.

From the above, it's very clear what the biggest advantage of Yeoman integration in NetBeans IDE will be: anyone will be able to browse through (the lower view above has built-in search and filtering features) the available generators and pick the ones they'd like to use directly in the place where the generated applications will be developed.

Monday Jan 26, 2015

Exposing Yeoman Generators to NetBeans IDE

The plan is to, as shown below, show all of the Yeoman generators and let the user select the generator they want to use.

Above, all of them are shown, including those already installed. The next step is to distinguish those that are installed from those that are not. If an uninstalled generator is selected, it will automatically be installed via 'npm install -g', after which it will immediately be used. If it is already installed, it will simply be used when selected, after Next is clicked above, and a folder is specified.

The biggest problem at that point will be ensuring that the generator runs non-interactively. Or to enable the user to enter somehow the arguments and parameters requested by the selected generator. Finally, the generated application will then automatically be opened into NetBeans IDE when the Yeoman process completes.

Friday Jan 23, 2015

Processing Output on the Yeoman Command Line

Here's where things are right now for Yeoman in NetBeans IDE. First, as pointed out yesterday, just like Maven projects from archetypes, you can create HTML5 applications from Yeoman:

When Next is clicked above, all the Yeoman generators that have been installed are shown, exactly as when you run "yo --help" on the command line:

(A feature I'd like to have would be to either have hardcoded or somehow generated the Yeoman generators that are listed here and then to let the user select the ones they'd like to have installed for them via NetBeans.)

(Also need to work more on the responses required from the generators. Right now, Enter is clicked automatically and the default generator is run.)

When Next is clicked above, the name of the selected generator determines the suggested project name of the application that will be generated.

When Finish is clicked, the generator is run in the location specified above, with the result shown below.

The next step is for me to add an 'nbproject' folder in there, with the correct content, so that the application will be recognized as a NetBeans HTML5 application. And then it will automatically be opened into NetBeans IDE, i.e., as soon as it has been generated via the steps above!

Thursday Jan 22, 2015

Parsing the Yeoman Command Line

The Yeoman command line, when you run "yo --help", shows you the available Yeoman generators that you have installed:

Integrating Yeoman into NetBeans IDE means that you want to let the user make use of those generators from within a New Project wizard, i.e., as discussed in this blog yesterday. So, here you go, thanks to Steve Souza (sitting on the couch at Concerto in Amsterdam next to me, great coffee and free Wifi hurray) and me:

The code for this is here on GitHub: You'll see the Yo executable is hardcoded, that's one thing I'll be working on, via a new item in the Options window.

Now that the above is done, things are looking pretty good. The user will select one of the installed generators (there'll also be a list of available generators that haven't been installed yet), click Next, and then the "yo" command will be called from NetBeans, the app will be generated, and will open automatically as an HTML5 project (from existing sources) in NetBeans. (JBoss Forge and LazyBones support for NetBeans should be implemented in a similar way.)

Wednesday Jan 21, 2015

How to Implement Yeoman in NetBeans IDE

I've been looking into what it would take to support Yeoman in NetBeans IDE. My initial idea was to use the dynamic actions mechanism (see it on YouTube here), to create something like the "External Tools" functionality in IntelliJ IDEA, where you can register Yeoman configurations as external tools, which means each configuration gets a keyboard shortcut, menu item, and toolbar button for invoking the configuration.

I showed the above approach to Ralph Ruijs yesterday and his immediate reaction was along the lines of: "That's just weird. If I want to create a new project via Yeoman, I'd expect to be able to go to the New Project wizard and have access to all the available Yeoman commands via a Yeoman category." Of course, it's a pity I can't use the dynamic actions approach but I agree that it doesn't apply so well in this context. So then I spent some time working on "dynamic project templates" instead of "dynamic actions", which is doable, but even more difficult.

And then... I thought about how Maven archetypes are suppored in NetBeans IDE:

When you want to create a Maven project from an archetype from the on-line Maven repository, you go to the above project template in the New Project wizard. When you click Next above, you see this dialog:

What that means for Yeoman (and for JBoss Forge, I believe) is that, assuming one wants to be consistent with the existing NetBeans IDE approaches, is to create an entry point like this:

When Next is clicked above, a dialog should appear similar to the second step of the Maven archetype wizard. At that point, "yo -- help" should be run (same as is done for grails and griffon in NetBeans IDE), which will then give access to the available generators, which should be made available in a drop-down list, which the user can then select, at which stage the generators are executed.

In other words, that means (1) no dynamic actions are needed and (2) no dynamic project templates are needed. Instead, a much simpler solution based on an existing NetBeans pattern is applicable here and, as you can see above, will provide a very clear entrypoint into Yeoman from within NetBeans IDE.

Tuesday Jan 20, 2015

Free: Virtual Technology Summit by Oracle Technology Network

The Oracle Technology Network (OTN) is excited to invite you to the Virtual Technology Summit Series.  Four times a year come and join us to learn first hand from Oracle ACEs, Java Champions, and Oracle product experts, as they share their insight and expertise on using Oracle technologies to meet today’s IT challenges. Four main content areas covered will be Database, Java, Middleware and Systems.  

Are you struggling in being productive with Maven, HTML5 frameworks such as AngularJS, IoT hardware such as the Raspberry Pi, and Java EE? Do you want free, easy to use, out of the box tools for quickly and efficiently developing all kinds of applications? You really need to give NetBeans a whirl!

In the "Free Open Source Tools for Maven, HTML5, IoT, and Java EE" session, during the upcoming free Virtual Technology Summit by OTN (nice and simple URL we'll show you the latest enhancements and cool features of the free, open-source NetBeans IDE, which are used around the world, from engineers at Boeing and NASA to Java architects such as James Gosling and Stuart Marks!

If you haven't looked at the NetBeans IDE lately, you'll be blown away by the fast speed and performance enhancements. If you are completely new to the NetBeans IDE, see how easy it is to get started and be productive.

Tip: The full agenda is available here and notice that the session described above is in the Java Content Area:

The sessions are prerecorded, while the speakers and other experts will be available live, to answer questions. To give a sneak peak at what the site will look like, take a look at these two screenshots from the session described above.

Click below to register. Pick a date and time that matches your location:

  • Americas February 11th - 9am to 12:30 PT - click here.
  • EMEA February 25th - 9am to 12:30 GMT - click here.
  • APAC March 4th - 9:30am to 1pm IST - click here.

Spread the news to members of your JUGs, colleagues at your office, and fellow students at your schools, colleges, and universities!

Monday Jan 19, 2015

Gulp for NetBeans IDE (Part 2)

Turns out there was no point in getting started making Gulp support for NetBeans IDE myself, since it's already part of daily development builds, and much better than my support was going to be.

For details on this and all the other awesome new features that are already available, go here: 

Sunday Jan 18, 2015

Gulp for NetBeans IDE (Part 1)

The first part of Gulp support is complete. When the plugin is installed, the 'gulpfile.js', if it exists, is parsed and all the Gulp tasks are shown as child nodes of a new Gulp node in the Projects window:

Creating the above was trivial. Initially I got into all kinds of problems when I started by creating a new file type for Gulp files. But the solution ended up being much simpler than that. Using the NetBeans Project Type Extension Tutorial, I registered a new for the org-netbeans-modules-web-clientproject project type.

All the code is here:

The next step I'm working on is being able to run those Gulp tasks from within NetBeans. Once that's done I'll publish the plugin in the NetBeans Plugin Portal.

Saturday Jan 17, 2015

Knockout.js in 2 Minutes (Part 3)

Instead of hardcoding the values, let's read them from a JSON file, "courses.json", which I have in the same folder as the "index.html" file:

        "name": "John",
        "courses": [{"title":"History"},{"title":"Geography"}]
        "name": "Bob",
        "courses": [{"title":"Science"}]
        "name": "Susan",
        "courses": [{"title":"Math"},{"title":"English"}]



Friday Jan 16, 2015

Knockout.js in 2 Minutes (Part 2)

If you liked part 1, you should squeeze in another 2 minutes and watch part 2!


<script src="js/libs/knockout/knockout-min.js" type="text/javascript"></script>

Name: <input data-bind="value: name, valueUpdate:'afterkeydown'" />

    Hello, <span data-bind="text: name"></span>.
<ul data-bind="foreach: courses">
    <li><span data-bind="text: title"></span></li>

<script type="text/javascript">
    var viewModel = {
        name: ko.observable("John"),  
        courses: ko.observableArray([{"title":"History"},{"title":"Geography"}])  

Thursday Jan 15, 2015

Knockout.js in 2 Minutes (Part 1)

Scratching your head over Knockout.js? Spend two minutes getting your feet wet here:


<script src="js/libs/knockout/knockout-min.js" type="text/javascript"></script>

Name: <input data-bind="value: name, valueUpdate:'afterkeydown'" />

    Hello, <span data-bind="text: name"></span>.

<script type="text/javascript">
    var viewModel = {
        name: ko.observable('John')  

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.


« April 2015