Monday Jul 13, 2015

New JavaScript Formatting Features in NetBeans IDE 8.1 (Part 1)

In NetBeans IDE 8.0.2, these are the Formatting options that relate to JavaScript files:

Notice that in NetBeans IDE 8.1, new features have been added here:

In the next two blog entries, we'll look at the new features added above.

Friday Jul 10, 2015

Refactoring Java in NetBeans IDE 8.1 vs. 8.0.2

It may seem small, but it can be very powerful, once you learn the new keyboard shortcuts... refactoring in the next release of NetBeans:

Compare that to the current release of NetBeans, where the majority of the keyboard shortcuts above are not present:

Thursday Jul 09, 2015

Android Release APK via Cordova in NetBeans IDE (Part 2)

Got some notes from my colleague JB Brock on yesterday's blog entry:

  • The process you describe will build the release apk, but if you click on the Run icon in NB, it will use the sim-android ant target and that is still defaulted to debug.  It does not run the release apk on your device unless you add the --release to the sim-android target as well.

  • When you set the --release to the sim-android target, it does indeed create the release apk, but it fails to launch on the device if you don't have the proper certificates installed.

    ERROR: Failed to launch application on device: ERROR: Failed to install apk to device:     pkg: /data/local/tmp/android-release-unsigned.apk

    So, while you can build it with --release, you cannot deploy it unless you have the proper keys setup.  That is another thing to look into.

Wednesday Jul 08, 2015

Android Release APK via Cordova in NetBeans IDE (Part 1)

To create the Android release APK via Cordova in NetBeans IDE, you need to add the '--release' flag to the 'build-android' Ant target in 'nbproject/build.xml'. Click to enlarge the image below:

The first time you build the project, the 'create-android' target will be run. That uses the 'add' command on Cordova, creating the 'android-debug.apk' and 'android-debug-unaligned.apk'. Subsequent builds of the project will automatically call the 'build-android' target, which uses the 'build' command on Cordova, where you have added the '--release' switch, which will automatically create 'android-release-unsigned.apk'.

Sunday Jul 05, 2015

News from NetBeans Zone

I have been involved with DZone for many many many years. I, quite seriously, go back a lot of many years with DZone. At the time, Rick Ross and Matt Schmidt were the driving force behind something called Javalobby. Later, Nitin Bharti was involved too, after which I interacted mostly with James Sugrue (who I still need to have a drink with in Ireland), and later still with Mitch Pronschinske. At the time, I was one of the editors on Javalobby.

Near the start of all that, I wrote general pieces of interest in the Java software world. For example, in November 2007, I wrote a pretty influential article on Javalobby entitled "What's So Groovy About Groovy?" It helped developers understand Groovy, in contrast to things-not-Groovy. I really enjoyed the interview format, especially interviewing multiple people, about a very clear and simple topic, e.g., "What is the Google Collections Library?" and Interview: Porting Open Source Java to Leopard. I liked the approach of getting to the core players in an issue and asking the core questions of them. The articles I wrote and discussions I started are relevant to this day, such as How do you parse HTML in Java?  That's it, that's all, that's what I wanted to do, write articles that focused on new and interesting things, right from the source, as well as gather information around an interesting theme.

Then at some point Javalobby became DZone. Fine. Instead of an editor, my role was that of moderator. There was a dedicated subsite for NetBeans, i.e., NetBeans Zone. We, i.e., the NetBeans community, posted about 3 or 4 brand new articles on NetBeans Zone every week. We piped NetBeans Zone through the Welcome Screen of NetBeans and also through At some point, a lot of NetBeans articles were in the "Five Favorite NetBeans Features" series, which were really helpful in getting people to understand the unique aspects of NetBeans. Quite a few of them were announcements about new NetBeans Platform applications. Or there were announcements about agendas for upcoming NetBeans Days. In short, there was a diverse range of articles that all related to NetBeans, of course, always on NetBeans Zone. Whenever there was a NetBeans Day somewhere in the world, we talked about and promoted NetBeans Zone, etc. We, i.e., the NetBeans community, have been promoting DZone for several years now, including it in our slide decks at conferences, talking about how this is a key place where the NetBeans community shares its insights and tips and tricks and news with the world, etc.

Together with NetBeans Zone, there was also a dedicated site for Eclipse and for JetBrains, i.e., for IntelliJ IDEA and related JetBrains products. However, there's no point in providing links to them... because none of these zones exist anymore. I discovered this by going to yesterday and finding that... it simply is no longer there.

Herewith is the correspondence with DZone that followed. It is so absurd that I shouldn't be alone in being aware of it. Also, I'm already getting e-mails from people who have articles published on NetBeans Zone, which no longer exist, and clearly whatever redirects have been set up are not working yet. Suffice to say, I am going to do everything I can to move over to Coman Hamilton, who runs, indicated recently to me that if there were to be enough new content on a regular basis about NetBeans on, that he'd set up a subsite dedicated to NetBeans. Since, over the years, we've been contributing 3 or 4 articles a week to DZone via NetBeans Zone, that's certainly enough content to make me think that this is the avenue we should take. Anyone that disagrees with me after reading the correspondence below is more than welcome to say so! I remain open to correction and admonishment. If there is anything in the below where I have overstepped the mark or where I have said something inappropriate, I am longing to hear about it.

Friday Jul 03, 2015

Quo Vadis Enterprise JavaScript?

In this shaky new world of JavaScript, here are the libraries I find to be very interesting:

When creating enterprise JavaScript applications, i.e., applications that are scalable and that need to be flexible and responsive, a combination of the above solutions could result in a maintainable application based on solid principles.

Here's an application I've been working on that combines some of the above, though I'm adding more of them over time:

The alternative to the above stack is AngularJS, which I think is a great solution if you buy into the entire philosophy of AngularJS. It's the "put all your eggs in one basket" approach vs. the "hey, let me build my own stack for my own needs" approach. It's also the "library vs. framework" debate. These debates have been going on forever. But, I think, in the JavaScript ecosystem, right now, this is pretty much where things stand.

Thursday Jul 02, 2015

Five Reasons to Apply for the NASA Java Opportunity

I mentioned the new job at a.i. solutions here yesterday. Sean Phillips, the great guy and NetBeans Dream Team member and author and many other things, you'll be working with, gave me the following 5 reasons for taking up the gauntlet and applying for the job!

  1. a.i. solutions provides Flight Dynamics and Launch Service Support to a large cross-section NASA and USAF centers and missions.

  2. Engineers at a.i. solutions are presented with a variety of space flight missions including LEO and International Space Station operations, Debris detection and collision avoidance and even Deep Space mission design.

  3. Software Engineers are given a significant degree of creative freedom to architect overall software designs while working directly with the country's top Space Flight Dynamics experts.

  4. The James Webb Space Telescope Flight Dynamics Ground System (JWST FDGS) ConOps integrates a variety of high fidelity modeling and simulation tools.

  5. The JWST FDGS faces design challenges including Parallelization, Big Data and custom Data Visualization.  The software engineers will be depended on to identify and apply the best software technologies to meet these challenges.   

And, need I say more, you'll be working on awesome Duke's Choice Award winning NetBeans Platform based network satellite software like this:

Wednesday Jul 01, 2015

Get Paid to Work for NASA with Java and NetBeans

Quite possibly the coolest job in the world for Java developers, with US citizenship, ideally with NetBeans Platform experience:

I love this bullet in particular up there: "Participate in inter-disciplinary teams to design and develop systems capable of supporting real-time satellite flight operations." That sounds amazing. :-) 

And if you're reading the above while thinking "Hmmm. I wonder what JWST means?" Then you should definitely take a look at this:

All the job details are here:*A8E0B5D35817721B

Tuesday Jun 30, 2015

YouTube: NetBeans at JavaOne Brazil

During JavaOne Brazil last week, I made two short screencasts and published them on YouTube. They're both interviews, both with someone saying nice things about NetBeans!

Here's more from Diego in a blog entry:

Watch more NetBeans videos here:

Monday Jun 29, 2015

YouTube: New Praxis LIVE Screencasts

One of the great people I met at NetBeans Day UK was Neil C. Smith, who is the developer behind the brilliant Praxis LIVE (@PraxisLIVE) project, the hybrid visual IDE for live visual coding.

Here's two screencasts he made about Praxis LIVE, recently, based on the demos he did at NetBeans Day UK.

Pretty amazing what can be done with the NetBeans Platform...

Friday Jun 26, 2015

International Synergy for Kendo UI Core in NetBeans

During JavaOne Brasil, quite a bit of work was done on the Kendo UI Core plugin for NetBeans! Opposite me at a restaurant (where we had endless heaps of great Brazilian meat and beer and so on) were sitting Mauricio Leal, Leonardo Zanivan, and All Pereira. I kind of mentioned to them that I was having problems with regular expressions for some pretty complex parsing of Kendo UI Core documents, the output of which is passed into the NetBeans code completion box.

It turned out that the three of them are a lot more experienced in regular expressions than I am. In fact, they'd been doing quite a bit of work with regular expressions recently and so the logic was still fresh in their minds. Right there in the middle of the food and plates and so on Mauricio, in particular, started hacking at the code. Leonardo and All also joined in. Then later I met with Leonardo and All at the Hackergarten, thanks to Heather van Cura:

And so it was that an international bond was forged between Heather (from the US), me (from the Netherlands), and Leonardo, All, and Mauricio (all from Brazil). Without Heather, we'd probably not have met up and without the Brazil guys we'd not now have a much better parsing. Compare the before with the after to see the difference, i.e., the same document is parsed, but now the information returned to the code completion box is far more complete:



The above is thanks to the pull that Leonardo made available:

There's still quite a bit more work to be done to get the parsing even more complete, plus we want to add caching to speed up the parsing.

Some people have encountered problems installing the plugin, which is because an implementation dependency is used, rather than public APIs. It should, in theory, work in NetBeans IDE 8.0.2, though not everyone has got it to work, i.e., installation fails because of conflicts between the implementation dependency and the already installed JavaScript2 Editor module. I have a workaround for this and will make a screencast about it soon.

The sources of the plugin is here:

And the binary is here:

Thursday Jun 25, 2015

Trip Report: NetBeans Day Brasil

The first NetBeans Day Brasil ever (or, possibly, in a long long time) was held on Monday 22 June 2015 in the Oracle office in Sao Paolo, food sponsored by the Oracle Technology Network, and goodies provided by a variety of NetBeans partners, such as a copy of JavaFX Rich Client Programming on the NetBeans Platform, by Paul and Gail Anderson of the Anderson Software Group.

A key aspect to this event is that it is awesome that we now have a location for this in Brazil, i.e., the Oracle office sponsored this event with a very nice auditorium. Many thanks to Bruno Borges from Oracle for arranging this.

The content delivered at the event was really great. Except for myself, all the speakers were local and everything was in the local language, i.e., Brazilian Portuguese. That makes a big difference at these kinds of local events.

Topics included JavaScript/HTML5 with NetBeans, Nashorn, IoT, and an overview of NetBeans IDE itself. The full agenda is here. Speakers were Bruno Souza, Bruno Borges, Vinicius Senger, and Leonardo Zanivan.

A definite highlight was an overview of new features in the upcoming NetBeans IDE 8.1 by a great new active member of the NetBeans community -- Leonardo Zanivan.

Node.js, HTML5, JBoss Forge, and Other Awesome New NetBeans Features

Drinks and snacks were great, thanks OTN:

Everyone thought it was unfortunate that only about 1/3 of those who registered showed up, but those who were there were very enthusiastic at the end of the day and want to help promote this next time and they suggest that we use the local Brazilian media, e.g., message boards, etc, to promote NetBeans Day. However, since this was the first event of its kind in Brazil (or, in fact, in Latin America in general), it was really a "getting to know you" and "let's see what this is" kind of event, i.e., we're really just getting our feet wet here and now we have a base to start getting things going more seriously in terms of attendance at the next NetBeans Day in Brazil. We're also thinking of new strategies to ensure there's a closer correlation between registrations and attendance, e.g., maybe charging a few dollars for registration, for example, i.e., to make the commitment stronger to the event, though there are downsides to this approach, i.e., harder to get students to sign up then, etc.

All in all, a nice start, definitely worth repeating at a larger scale. Many thanks to the speakers and attendees for participation in this event!

Wednesday Jun 24, 2015

Take Early JDK 9 For A Spin In Early NetBeans 9

Here's a super cool new development for the true adventurer, the wild side walker, and the most cutting edge of cutting edge Java developers.

Could this be you?

From today, there's a brand new build of NetBeans IDE focused very specifically on giving you the tools you need for taking the early access build of JDK 9 for a spin:

Spread the word and get involved in the process. Once you have downloaded the early access JDK and early build of NetBeans IDE, register the former in the latter, which will expose the JDK to your Java SE projects:

For all the details, including how to give feedback:

Tuesday Jun 23, 2015

Released: Kendo UI Core Plugin for NetBeans IDE

The first release of the Kendo UI Core plugin for NetBeans IDE is available:

It provides two features. The first feature exposes the Kendo UI Core components to the code completion box:

The second feature gives the code completion box access to the attributes of the current Kendo UI Core component, i.e., here you see the attributes of the KendoCalendar component are available in the code completion box because the KendoCalendar is the currently used component:

In both cases, you can see documentation is included. Everything in the code completion box, provided by this plugin, comes from documentation by the Kendo UI Core team, such as this one:

More features are being worked on, including more information in the code completion box and any feedback is welcome.

Sunday Jun 21, 2015

Handy Parsing Utilities for Markdown

Kendo UI comes with Markdown documents that I'm working with to provide content for the code completion box:

Initially I was using some kind of Markdown parsing library, but then I realized hey why not simply use pattern matching instead: 

public class DataLoader {

    private static final Set<DemoDataItem> items = new HashSet<DemoDataItem>();

    public static Set<DemoDataItem> getData(List<File> files) {
        for (File file : files) {
            try {
                String asText = FileUtil.toFileObject(file).asText();
                String pattern = "title: [A-Za-z]+";
                Pattern p = Pattern.compile(pattern);
                Matcher matcher = p.matcher(asText);
                if (matcher.find()) {
                    String formattedText ="title: ", "kendo");
                    items.add(new DemoDataItem(formattedText, null, escapeHTML(asText), null));
            } catch (IOException ex) {
        return items;

    public static String escapeHTML(String s) {
        StringBuilder out = new StringBuilder(Math.max(16, s.length()));
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (c > 127 || c == '"' || c == '<' || c == '>' || c == '&') {
                out.append((int) c);
            } else {
        String addBreak = out.toString().replace("\n", "<br />\n");;
        return addBreak;


Saturday Jun 20, 2015

Code Completion Context for JavaScript Editors

You don't want the items in your code completion box extension to appear regardless of context. For example, Kendo UI components should only appear in the code completion box after the dot in this kind of structure:

For that reason, the org.netbeans.modules.javascript2.editor.spi.CompletionContext class exists.

It provides String constants that you can use to limit the appearance of your items to the context to which they apply.

Usage is simple. For example, look at the code in bold below. That's all I needed to do to cause the Kendo UI components that you see above to appear only in the place in the statement that you see above.

public List<CompletionProposal> complete(
        CodeCompletionContext ccContext,
        CompletionContext jsCompletionContext,
        String string) {
    if (jsCompletionContext != CompletionContext.OBJECT_PROPERTY) {
        return Collections.EMPTY_LIST;
    List<CompletionProposal> result = new ArrayList<CompletionProposal>();
    Set<DemoDataItem> data = getData();
    for (DemoDataItem item : data) {
        result.add(DemoCompletionProposal.createDemoItem(item, 0));
    return result;

In the next example, I want the Kendo UI options to appear for the related Kendo UI component and only within the braces of the statement, as shown below. Getting directly into the braces is a bit more work, but changing the code above to CompletionContext.OBJECT_PROPERTY_NAME is the starting point for getting the items within the code completion box only within the parentheses.

For a good example, take a look at the switch statement in this piece of code by Tim Boudreau.

The richness of these APIs holds the tremendous promise for NetBeans to be the meeting point of all imaginable JavaScript frameworks and libraries.

Friday Jun 19, 2015

How To Make Your Own JavaScript Editor

Code completion is the key feature you need when adding support for your own JavaScript framework to NetBeans IDE.

Above you see a new item I added by means of a simple starting point, which starts like this:

package org.demo;

import java.util.ArrayList;
import java.util.List;
import org.netbeans.modules.csl.api.CodeCompletionContext;
import org.netbeans.modules.csl.api.CompletionProposal;
import org.netbeans.modules.csl.api.ElementHandle;
import org.netbeans.modules.csl.spi.ParserResult;
import org.netbeans.modules.javascript2.editor.spi.CompletionContext;
import org.netbeans.modules.javascript2.editor.spi.CompletionProvider;

@CompletionProvider.Registration(priority = 20)
public class DemoCompletionProvider implements CompletionProvider {

    public List<CompletionProposal> complete(
            CodeCompletionContext ccc, 
            CompletionContext cc, 
            String string) {
        List<CompletionProposal> result = 
                new ArrayList<CompletionProposal>();
        DemoDataItem ddi = new DemoDataItem("a", "b", "c", "d");
        result.add(DemoCompletionProposal.createDemoItem(ddi, 0));
        return result;

    public String getHelpDocumentation(
            ParserResult pr, 
            ElementHandle eh) {
        return "help documentation";

Here is where the full code sample, i.e., a basis for your own new extension to code completion in the JavaScript editor in NetBeans, can be found:

Thursday Jun 18, 2015

Kendo UI in NetBeans IDE

Johan Borchers, from KPMG Crimsonwing in the Netherlands, was one of the people at the Blue4IT event where I talked about the JavaScript landscape. He mentioned that the only tools he's found for Kendo UI Core, his favorite JavaScript toolkit, is Visual Studio:

Here you can see there's code completion in Visual Studio for Kendo UI components, together with documentation showing you the options you can add to the argument object.

Displaying the classes in code completion (i.e., IntelliSense) in NetBeans is already supported, if you check out the sources of Kendo UI from its Git repository and put them into your HTML5 project in NetBeans. NetBeans will then detect the sources that you have added, which you can of course exclude from your Git commits, and then display relevant proposals in the code completion box:

However, I'm also working on a plugin that shows, context sensitively, the options available for the current Kendo UI component. Here you see what happens when I call up code completion for KendoCalendar:

And here, to show you that each Kendo UI component is supported via its own set of options in code completion, is what you'll see for KendoAutoComplete:

How it works is that the plugin will contain all the documents from the Kendo site, such as this one:

These are then parsed and integrated into the code completion box in NetBeans. In other words, all the code completion and related documentation will come from the Kendo UI site, i.e., they will be copied into the NetBeans module and used from there. Indeed, if they change on-line, there'll be no way of knowing that, plus the authors of those documents possibly don't treat them completely as an API, which is how I am treating them. Unfortunately, I don't see a better way of doing this.

I'm not parsing completely correctly yet, hence some of the options are clearly missing from the two screenshots above. Once  everything is working as it should, the documents will be read from the layer.xml file, meaning that anyone will be able to add new ones to their user directory and NetBeans will automatically pick it up, e.g., when a new Kendo UI component is made available, together with its documentation.

Soon the first draft of the plugin should be available and it will be developed on GitHub, so anyone out there is free to join in:

Wednesday Jun 17, 2015

"Everything a Java developer should know about the JavaScript landscape"

For a few months I've been working on a presentation aimed at Java developers, to introduce them to the brave new world of JavaScript, not JavaScript the language, but JavaScript the constantly changing ecosystem.Why? Because this topic is something of relevance to the Java community and it's an interesting area to look at. It makes sense to examine the JavaScript ecosystem and to evaluate the extent to which its current popularity is a trend or a hype and what Java developers can do with it and maybe benefit from it in the context of their existing Java applications, too.

The story starts by looking at new enhancements in HTML (thanks to HTML5) and CSS (thanks to CSS3) and then in more detail at all the different kinds of JavaScript solutions (core libraries, build tools, application frameworks, testing frameworks, and component suites) that a Java developer should be aware of when beginning to get their toes wet with JavaScript. After that, a brief look at various kinds of transpilers, e.g., CoffeeScript, TypeScript, Dart, GWT, Vaadin, and DukeScript. Yesterday I presented that story for the first time, at a session organized in Bodegraven in the Netherlands by Blue4IT, a great organization (always on the lookout for new local developers to hire) which recently hosted Adam Bien and will be hosting Martijn Verburg in October.

The demonstrations done during the session:

  • HTML5 as an 'application framework' via new elements and attributes, see the HTML5 Fun Pack.
  • Responsive CSS via media queries vs. Responsive JavaScript via Response.js and Foundation.js.
  • Monolithic vs Modular via Require.js, using these examples.
  • AngularJS, Knockout.js, and Backbone.js.
  • Java EE backend with JavaScript fronted, via RESTful Web Services.
  • Solid Knockout, a Knockout/Require.js template for JavaScript enterprise apps.
  • DukeScript, enabling UIs in HTML and business logic in Java instead of JavaScript.

The feedback was pretty positive. What surprised me the most was that Java developers, at least in this session, were not necessarily doing everything they could to avoid coding in JavaScript, i.e., even though it is loosely typed and has all kinds of problems, developers appeared to be quite excited about working with a new language and a new ecosystem. Several have already been crossing over to JavaScript and, sure, despite that there are problems with it, all ecosystems have problems of one kind or another, though everyone is always interested in using the technologies that are new and popular.

In particular, AngularJS is something everyone wants to start doing things with, to the extent that they haven't already, simply because there's so much buzz around it. I tried to make the case for a few alternative solutions, especially Knockout.js, since I do believe it allows for a more flexible architecture than that enforced by AngularJS. I presented DukeScript as a credible solution for those who want to continue coding in Java and it did feel like a lot of people were interested in the notion of JavaScript as an assembly language, i.e., something that the browser needs but that no developer should need/want to touch. Nevertheless, it feels to me that the new and cool technologies that run in the browser, i.e., all these various cool JavaScript frameworks, are going to win simply because there's so much energy around them and even the most hardcore Java developers don't have a problem at all in changing their toolbox, including their language, every few years or so. JavaScript is new and fun and there are not many hardcore dogmatic Java developers who would reject it out of some kind of principled objection to anything that isn't Java.

Of course, and this is the basic underlying principle to all of this, the tools and technologies you choose depend on the kinds of business requirements you have. If you're going to be creating an air traffic control system that should remain functional for the next 10 years and be operated by 6 users in a control tower, obviously you're not going to use JavaScript and the browser. However, if you're going to create a SPA primarily targeted at desktop browsers, tablets, and mobile devices, all at the same time, then the JavaScript ecosystem is the most obvious candidate for implementing your requirements. 

Anyway, let's see what happens in the coming years. There certainly is more than enough choice out there, that's for sure. 

Note: Happy to do this presentation again to any organization interested in getting a thorough overview of all the things going on in the JavaScript ecosystem.


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.


« August 2015