Česky   |  Deutsch   |  English   |  Español   |  Français   |  Indonesia   |  日本語   |  한글   |  Polski   |  Português (BR)   |  Türkçe   |  中文   |  正體中文   |  Your Language  
Planet NetBeans is an aggregation of NetBeans related musings from all over the Blogosphere.
[RSS 1.0 Feed] [RSS 2.0 Feed]
[FOAF Subscriptions] [OPML Subscriptions]
Do you blog about NetBeans ? Add your blog to PlanetNetBeans.
Feed Subscriptions
NetBeans Zone - The social network for developers (feed)
APIDesign - Blogs (feed)
ludo's blog (feed)
pandaconstantin's blog (feed)
hansmuller's blog (feed)
pkeegan's blog (feed)
richunger's blog (feed)
tball's blog (feed)
timboudreau's blog (feed)
David R. Heffelfinger (feed)
Carsten Zerbst's Weblog (feed)
Winston Prakash's Weblog (feed)
Need to find a title (feed)
Roger Searjeant's blog (feed)
Optonline Webmail (feed)
Michael's blog » NetBeans (feed)
DukeScript (feed)
ProNetBeans (feed)
Paulo Canedo » NetBeans English (feed)
Bistro! 2.0 (feed)
Anchialas' Java Blog (feed)
markiewb's blog (feed)
Anuradha (feed)
Netbeans6/6.5 my best practices (feed)
Java Evangelist John Yeary's Blog (feed)
Java, business and... NetBeans ! [[ Jonathan Lermitage ]] - NetBeans IDE (feed)
Neil's Dev Stuff (feed)
Category: NetBeans | Software and Science (feed)
Computer says null; (feed)
NetBeans Adventures, Java and more (feed)
Allan Lykke Christensen » NetBeans (feed)
Inspiration and Expression » Netbeans (feed)
open source. open mind. (feed)
John O'Conner » NetBeans (feed)
Koberoi Oracle (feed)
Adam Bien (feed)
Ignacio Sánchez Ginés » NetBeans (feed)
Bernhard's Weblog (feed)
Michel Graciano's Weblog (feed)
Ramon.Ramos (feed)
Ozone and Programming » netbeans (feed)
NetBeans Ruminations » NetBeans (feed)
Tiplite » netbeans (feed)
Arun Gupta, Miles to go ... (feed)
Geertjan's Blog (feed)
.JARa's Bilingual Weblog (feed)
JavaFX Composer (feed)
The Java Jungle (feed)
Jesse Glick (feed)
Martin Grebac (feed)
The NetBeans Community Podcast (feed)
NetBeans Profiler (feed)
NetBeans for PHP (feed)
NetBeans Web Client (feed)
Rechtacek's (feed)
Virtual Steve (feed)
My First Blog - Satyajit Tripathi (feed)
The Aquarium (feed)
Tinuola Awopetu (feed)
Insert Witty Irony Here (feed)
Gualtiero Testa » Netbeans (feed)
James Selvakumar's Blog » netbeans (feed)
nB gUru » NetBeans (feed)
Newsintegrator Blog » netbeans (feed)
Praxis LIVE » NetBeans (feed)
TechAshram » NetBeans (feed)
There's no place like » Netbeans (feed)
mkleint (feed)
NetBeans Community Docs Blog (feed)
The Netbeans Experience (feed)
NbPython/ jpydbg / pymvs (feed)
Shanbag's Blog (ರಜತ ಲೋಕ) (feed)
Wade Chandler's Programming Blog (feed)
Devlin's Lab (feed)
Big Al's Blog (feed)
Code Snakes (feed)
In perfect (spherical) shape (feed)
Van Couvering Is Not a Verb (feed)
Diego Torres Milano's blog (feed)
Vroom Framework (feed)
Messages from mrhaki (feed)
Jeff's Blog (feed)
Oliver Wahlen's Blog (feed)
Shuttle between Galaxies (feed)
Welcome to my live... (feed)
Netbeans IDE Blog by Tushar Joshi, Nagpur (feed)
Devel Blog (feed)
diamond-powder (feed)
Manikantan's Netbeans (feed)
Antonio's blog (feed)
Where's my Blog?!

Powered by:    Planet

Last updated:
March 05, 2015 03:05 PM
All times are UTC

Sponsored by
sponsored by Oracle

visit NetBeans website
Geertjan's Blog - March 05, 2015 09:05 AM
Free: Learn How To Use All 50 Java Keywords!

Kai Uwe Pel, who I met at NetBeans Day Netherlands recently, gave me a fantastic tip yesterday.

He told me about a great and free course that fills in any spaces you might have in your basic Java knowledge:


When you go there and log in, for free, you have access to a wonderful starting point or, possibly, a place where you can remind yourself of the basic principles of Java. It won't teach you object orientation and Java programming in general, as Huw Collingbourne's course does so well, but certainly it is excellent in covering the specific thing it covers.

Of course, NetBeans is used from beginning to end:

A fantastic free resource! Get started with it today.

Geertjan's Blog - March 03, 2015 08:51 PM
Learn Java, For Real, Thoroughly, With Huw and NetBeans IDE

The two tools you need when learning Java are Huw Collingbourne and NetBeans IDE. Watch this quick screencast on why this is the case:

For this week only, i.e., until Tuesday next week, there's a massive discount:


Once you buy the course (PayPal works brilliantly), you'll get this starting point with heaps of well structured lessons in bite size chunks:

You'll be a Java programmer before you're even aware of it!

markiewb's blog - March 03, 2015 10:36 AM
New version of JRebel for NetBeans Plugin 6.1.0

I am sure you already noticed that there was an update to the JRebel for NetBeans plugin.

Regarding to http://plugins.netbeans.org/plugin/22254/jrebel-netbeans-plugin version 6.1.0 contains the following changes:

  • Added support for launching Grails applications with JRebel.
  • Added JRebel startup tab to JRebel Configuration. Added setup instructions for three startup scenarios (IDE, CLI and remoting).
  • Added support for enabling/disabling JRebel agent per server and standalone project via the JRebel Configuration. Removed the global on/off JRebel toolbar button.
  • Fixed an issue with setting VPN IPs for remoting/cloud.

One highly visible and very useful new feature is the configuration wizard in the options. This way you can configure your app server/application to use JRebel without any external documenation. Good Job ZT!


NetBeans Zone - The social network for developers - March 02, 2015 11:59 AM
Interview: Huw Collingbourne on Java Programming Master Course

Last year Huw Collingbourne was highlighted here on NetBeans Zone in an interview about his work as a Java course developer. We caught up with him again about his latest course, Java Programming - The Master Course. Preview Text:  A NetBeans interview with Huw Collingbourne on his latest Java course that makes use of NetBeans. ...

Geertjan's Blog - March 02, 2015 11:18 AM
Transcript of "Free Open Source Tools" OTN Virtual Technology Session

The OTN Virtual Technology Sessions have now happened in two timezones, for the Americas and for EMEA. The final edition in the current series is for the APAC timezone, on March 4th, from 9:30 to 13.00 IST.

Read all about it here:


As you can see in the image above, while watching the pre-recorded screencasts, you can chat with moderators, who are generally the people involved in the making of the screencasts. I'm the one who made the screencast for "Free Open Source Tools for Maven, HTML5, IoT, and Java EE" and moderated the session. During the most recent one, for EMEA, there was quite some discussion, i.e., a lot of questions were asked while the screencast was being watched by quite a lot of people. Some wanted to see the transcript because a lot of info was shared. So, here it is! 

  • How much NetBeans costs? 
    It's free! Get it from netbeans.org -- free and open source.

  • Which plugin I need for using Maven in NetBeans? 
    Good question. No plugin needed. NetBeans natively supports Maven. No installation or configuration need.

  • What is "Internet of Things" doing here with JavaEE, Maven, and HTML5? I know internet is hugely connected with web applications but what is the specific reason here?
    Well, these are the key features of NetBeans -- it is a great tool for doing development for IoT, Java EE, Maven, and HTML5. That's why they're all included here, because NetBeans provides great tools for working with all of them, separately, or together.

  • It seems NetBeans is for more than just Java?
    Definitely! There's a special download bundle of NetBeans which is ONLY for doing HTML5 frontend development. All for free, which you can use together with or instead of Sublime or WebStorm. For free.

  • Your NetBeans looks faster and better than mine.
    That's because I'm using the "Dark Look and Feel Themes" plugin and because I have a very small version of NetBeans, which only contains HTML5 frontend tools, get it for free from netbeans.org/downloads.

  • Everything you mentioned so far is for free. Which products do we have to license?
    Nothing to license. All free. :-) Nothing in or with NetBeans is for any money at all, no licensing, whatever, etc. Free.

  • Bower, Node.js, Angular... what's going on here?! NetBeans has support for all of these? Even test coverage for JavaScript files?
    Yup, you're right, NetBeans is great.

  • Where can we find out more about all of this?

  • At the bottom of your screen it seems you have a browser inside NetBeans?
    Yes, very useful feature -- an embedded browser. I use it all the time.

  • What about MongoDB? Does NetBeans support it?
    There's MongoDB plugins on the Plugin Portal: http://plugins.netbeans.org

  • Does NetBeans have a presence on social media?
    Yes! New tips and tricks every day at facebook.com/netbeans, twitter.com/netbeans, and many moves at the NetBeans YouTube channel.

  • Where are the NetBeans YouTube videos found?

  • Is NetBeans a good replacement for Eclipse?
    Definitely. The Maven integration in NetBeans is much better than in Eclipse. The HTML5 tools too. For Java EE, there's no better IDE than NetBeans. 

  • Is NetBeans fast?
    For me, it takes 9 seconds to start up the HTML5 distribution of NetBeans. No JDK required for this, only the JRE.

  • How much does the enterprise version of NetBeans cost?
    NetBeans is 100% free. If you ever find yourself giving anyone any money for NetBeans, you can be 100% that you're being ripped off. :-)

  • Can NetBeans be used as an infrastructure for applications, just like Eclipse RCP?
    Yes, definitely. NATO and Boeing and many other organizations use it exactly like that: https://platform.netbeans.org/screenshots.html

Geertjan's Blog - March 01, 2015 01:50 PM
Why I Am Excited About JDK 8 Update 40

Doing JavaFX development? Take a look at the very clear performance enhancements in JDK 8 Update 40 (https://jdk8.java.net/download.html) by looking at a new EPUB plugin that's being worked on:

Geertjan's Blog - February 28, 2015 12:45 PM
Handy HyperlinkProvider

NCX files are XML files with a specific file extension, "ncx", which are part of EPUB, and below you can see that when I hold down the Ctrl-key and move over a "src" attribute in an NCX file, a hyperlink appears, which when clicked opens the referenced file.

The hyperlink code is as follows:

@MimeRegistration(mimeType = "text/ncx+xml", service = HyperlinkProvider.class)
public class NcxHyperlinkProvider implements HyperlinkProvider {

    private static String SRC_IDENTIFIER = "src";
    private String identifier;
    private int targetStart;
    private int targetEnd;

    public boolean isHyperlinkPoint(Document doc, int offset) {
        return verifyState(doc, offset);

    public boolean verifyState(Document doc, int offset) {
        TokenHierarchy hi = TokenHierarchy.get(doc);
        TokenSequence<XMLTokenId> ts = hi.tokenSequence(XMLTokenId.language());
        Token<XMLTokenId> tok = ts.token();
        if (tok != null) {
            int tokOffset = ts.offset();
            switch (tok.id()) {
                case VALUE:
                    while (ts.movePrevious()) {
                        Token<XMLTokenId> prev = ts.token();
                        switch (prev.id()) {
                            case ARGUMENT:
                                if (SRC_IDENTIFIER.equals(prev.text().toString())) {
                                    identifier = tok.text().toString();
                                    targetStart = tokOffset;
                                    targetEnd = targetStart + tok.text().length();
                                    return true;
                            case OPERATOR:
                            case EOL:
                            case ERROR:
                            case WS:
                                return false;
                    return false;
            return false;
        return false;

    public int[] getHyperlinkSpan(Document document, int offset) {
        if (verifyState(document, offset)) {
            return new int[]{targetStart, targetEnd};
        } else {
            return null;

    public void performClickAction(Document doc, int offset) {
        identifier = identifier.replaceAll("\"", "");
        FileObject fo = Utilities.actionsGlobalContext().lookup(FileObject.class);
        String path = fo.getParent().getPath();
        File file = new File(path + "/" + identifier);
        if (file.exists() && file.isFile()) {
            try {
            } catch (DataObjectNotFoundException ex) {


All the code: https://java.net/projects/epubopentoolbox/sources/epub/show/80/fosfor/fosfor-ncx.

Geertjan's Blog - February 27, 2015 08:42 AM
From Eclipse to NetBeans

It's kind of hard to tell the difference between the snippets of code below. But they come from two different tools, one of them is NetBeans and the other is Eclipse. I think it's irrelevant to say which is which since the rendering of the font of each is excellent. I'd happily work with font rendered by either of the two different tools below.

By default, the coloring, and other styling, of font in NetBeans looks different to how it looks in Eclipse. That's easy to solve, assuming you find this to be a problem, via this excellent addition to NetBeans:


When switching from Eclipse to NetBeans, it certainly helps a lot if the project you're migrating uses Maven as its build system. Maven-based projects are automatically recognized by NetBeans. NetBeans understands that if a folder contains a 'pom.xml' file, it is a Maven project. Hence there's no import process needed. Instead, you can simply go to File | Open Project to open any folder containing a 'pom.xml' file into NetBeans as a Maven project.

Finally, you'll find this very useful, thanks to Benno Markiewicz, which lets you import Eclipse formatting files into NetBeans and use them to format your files:


Adam Bien - February 27, 2015 02:51 AM
REST TX, Clustering, Dead SOAP, Timers, Microservices vs. Monolith, Principal Propagation or Questions for the 12th Airhacks

Last chance to ask questions. We will discuss them at 2nd March, 6.PM. CET: http://www.ustream.tv/channel/adambien:

  1. HTTP Session Replication and Clustering discussion Piotrek
  2. I have a question for you :) You may even queue it up for an upcoming stream, but I’m really curious! You stated that SOAP (support?) could even be removed from the API.I just got into the SOAP world a few months ago, came from a REST background, and I am really confident that it still has it’s place. The type safety, and the tools that Java gives us are really great. Why do people hate it so much nowadays? Plus in the finance sector they are relying on it really heavily still, so it’s a good thing to be familiar with either way IMHO. noherczeg
  3. Can two ejb modules communicate with each other through local interfaces in the same app server or JVM? (…) Viktor Citaku
  4. What’s the most effective/elegant way of implementing single-table multi-tenancy (with discriminator column) in JPA2/2.1 without using provider specific (like that of EclipseLink 2.5) [Mátyás B.]
  5. Example scenario: a J2EE app utilizing single-table multi-tenancy that would allow users to sign-in using either Facebook, Google, Paypal, etc. as well as using native accounts (username/pw in the application’s DB itself) while using the HTML UI of the App. Its REST Resources would need a ‘token’ to authenticate. App server: GF 4.1
  6. Do we need to propagate the security context (Subject/Principals) to EJBs if using a form-based authentication? Isn’t it better (and almost easier) to use custom annotations and interceptors to implement a “permission” based security (as opposed to the container’s role based security)? Octopus (https://bitbucket.org/contribute-bitbucket/javaeesecurityfirst) comes to my mind.
  7. Would a JASPIC ServerAuthenticationModule (SAM) fit this scenario? How to tell SAM which authentication method to start based on the user’s choice? Similarly, how to tell JASPIC that the REST resources need a completely different ‘SAM’? ratcashdev
  8. Single timer event of a EJB timers in a distributed application [Tibor D.]
  9. What do you think about gradle? What about use gradle instead of maven? Can you talk a little bit about this subject? @Brunos_Santos
  10. With Java 8 and streams I do not really get how the exception handling should work when composing several functions? (Michael G.)
  11. “I’ve added beans.xml, but I read somewhere we don’t need it in JavaEE 7? The error is gone even if the file is empty!!” PoslovniAdresar
  12. “Can we set scheduler time from some property file so that we don’t need to
    recompile for changing time? Also, while executing scheduler, can I set next execution time at runtime?” Valsaraj
  13. Can we get @scheduler configurations details from properties file? like sec,min… Ravi
  14. (...) In one of your past presentations, I believe I remember you saying that being monolithic is your friend, vs nowadays there’s a lot of discussion around microservices. Can the ideas of “monolithic is your friend” and microservices still peacefully co-exist in your mind? John Hogan
  15. REST is stateless:

    Some are claiming, that you should not even keep any client state on the server (no session, nothing).

    Does this not imply, that Java EE server sessions should not be generated for requests at all?

    How would you do that with stateful session beans then? I guess, they are completely out of scope for REST?

    Does this mean, that each request should contain a reference or concrete information about eg. user credentials or client state if the server needs that information? Is that not producing a huge communication overhead in some scenarios?
  16. How would you implement a user authentication with a UI based on a pure RESTful API? With tokens? How to pass and maintain tokens and invalidate “sessions” without keeping client state on the server? Would that not also be a potential performance problem, as the token (and thus, every single API request needing authorization) would normally always have to be sent over HTTPS to avoid being intercepted and risk identity theft?
  17. How would you maintain transactions over several REST API calls? Is that at all possible with REST? Or would it simply be maintained completely on client side until final submission? (I have read eg. this resource https://jcalcote.wordpress.com/2009/08/06/restful-transactions/, but I am not fully convinced by the solution, or maybe miss some points) [heppa](https://gist.github.com/heppa
  18. @Entity

    @PrimaryKey(validation=IdValidation.NONE, columns={@column(name=“a”), @column(name=“b”, @column(name=“c”)})

    public class MyView implements Serializable ……

    If I run the query (as JUnit test) then I will receive the following error message:

    Exception [EclipseLink–6044] (Eclipse Persistence Services - 2.5.1. …..

    org.eclipse.persistence.exceptions.QueryException Exception Description: The primary key read from the row [row omitted here] during the execution of the query was detected to be null. Primary keys must not contain null. jhoryna
  19. How would you structure your web application to keep one code base for several customers each with their own customizations? haisi

See also the airhacks archives airhacks.tv for past shows and subscribe to the airhacksnews.com.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting

Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - February 26, 2015 01:47 PM
YouTube: Format Multiple Files in NetBeans IDE

When lines of code in various kinds of files, whether of the same type or different types, are misaligned, you can reformat them (using the formatting rules you have defined in the Options window or the default ones you get out of the box from NetBeans) all at the same time. Whether or not you're using a project, i.e., you could be working with individual files in the Favorites window, reformatting multiple files is easily done. Watch this quick screencast to see how:

Adam Bien - February 26, 2015 08:39 AM
Rulz: EntityManager Provider for Integration Tests

I used EntityManager initialization for an integration test as a possible use case for JUnit Rule during the recent Continuous Java EE 7 Testing, Deployment and Code Quality workshop:

import static com.airhacks.rulz.em.EntityManagerProvider.persistenceUnit;

import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
import static org.junit.Assert.assertNotNull;
import org.junit.Rule;
import org.junit.Test;

public class WorkshopTest {

    public EntityManagerProvider emProvider = persistenceUnit("it");

    public void crud() {
        EntityManager em = emProvider.em();
        EntityTransaction tx = emProvider.tx();
        em.merge(new Workshop("Testing", "test what matters));

I noticed, the code is reusable, so I extracted the rule and created the open source project: Rulz and pushed the library into maven central:


A JUnit Rule is an alternative to inheritance, which I used so far: BCE Archetype.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting

Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - February 25, 2015 06:09 PM
Free Open Source Tools for Maven, HTML5, IoT, and Java EE

I took part in another edition of the OTN Virtual Technology Day today. It started with being invited to contribute a screencast to the event, which I made especially for this occasionenabling me to think afresh about what it is exactly that makes NetBeans special and so I focused on Maven, HTML5, Internet of Things, and Java EEand then I also moderated the sessions live, i.e., answered questions that attendees asked while attending the session.

A week or two ago, the event happened in the Americas timezone and today it was the turn for EMEA. From 10.00 to 14.30 today, attendees in the Java track heard from a range of speakers, including Tori Wieldt, Bruno Borges, and Gerrit Grunwald. The "Free Open Source Tools" session looked as follows, click to enlarge, and notice some of the cool questions that were asked while attendees watched the screencast: 

There were several other questions after the above were asked, all really great and enthusiastic. Very nice to get the kind of feedback I'm seeing at these events. 

One more chance for attending the series of screencasts that constitute OTN Virtual Tech Days is for the APAC timezone–on 4 March–from 9:30 to 13:30 IST. Looking forward to seeing even more attendees there! 

The agenda can be viewed here: https://community.oracle.com/docs/DOC-894285

Adam Bien - February 25, 2015 02:01 AM
A Java EE 7 Startup: TipiCamp

Interview with Christoph Gapp, an entrepreneur, passionate Java developer, airhacks alumni and the man behind tipi.camp

What is your background? Could you briefly introduce yourself?

I am a trained computer scientist and have been working for about 15 years as a freelance Java developer. I also belong to the core team of an established reservation system.

What is tipi.camp?

tipi.camp is an intuitive, efficient and affordable management and reservation system for campsites. The application is cloud based. We currently have clients in Germany, USA and Australia.

You attended the regular airhacks at Munich airport. Shortly after the workshops you started tipi.camp and hired me to answer some questions. Where you got the idea? How tipi.camp started?

I gained a lot of great input in the workshop and I was inspired to implement an application afterwards. Simple exercises were not enough for me. The idea for the camping project came during my last vacation and so that's why I thought that now is a great time to start.

Did you had the chance to chat with other attendees during the airhacks? If yes, what was the most interesting project / problem / situation in the workshops?

I found my colleague's project to be very interesting: Stock market software independently buys shares dependent on current weather data -- the sudden onset of winter temporarily puts a damper on Lufthansa's shares. The demand for road salt on the other hand helps K+S shares.

The main problem that my discussion partner experienced was because of exaggerated architecture in their own software.

How much code have you deleted after the airhacks workshop?

I take every opportunity to revise and delete. I'm not sure how much I deleted, but it was quite a bit of code -- at least 30%!?

Which technologies, servers, libraries are you using in tipi.camp?

Java 8, EE7 with Wildfly. Primefaces and some Jakarta Commons. The Wildfly runs with Docker and deployment is done using Jenkins.

How many developers are currently working on tipi.camp?


You are using the Entity Control Boundary pattern. What is the experience with that?

This keeps projects of any size very clear. Anyone can immediately navigate quickly in the source. I use always this pattern now.

You told me "Java EE's productivity is dangerous". What did you exactly meant by that?

The Java world has greatly changed in recent years and has become much easier and better. With the possibilities of Java EE 7 and some pragmatism you can focus entirely on business logic and put products faster on the market. Utilizing features from application servers is of course an incredible market advantage. Those capable of adapting fast will survive -- this is especially true for the software market.

What are the challenges you are currently facing?

Ongoing projects to migrate to EE 7. Exciting but should not be underestimated.

Are you providing support to your customers? How challenging is it?

The support effort is surprisingly low, although the software is heavily used ;) The user interface is intuitive and common use cases are covered with tutorial videos.

Monitoring is based on CDI observer / events, any meaningful potential problems can be identified before the customer writes an email.

What about the performance? Is Java EE fast enough?

The application is currently running on a low-cost standard server and is still very, very fast. The beans for JSF are all ViewScoped or RequestScoped, and the EJB's stateless -- this makes the memory requirements very manageable.

You migrated from GlassFish to Wildfly. Was the migration painful? How much time did you spend for the migration?

The migration from the sourcecode surprisingly easy -- I needed just 1 day for minimal modifications. The Wildfly is easy to manage, I needed 2 days for selftraining with free tutorials. That was all.

Do you have any secret ideas for new startups?


Will you choose Java EE for the realization of your ideas again?

Definitely yes. Java EE is a free to use startup-igniter.

Christoph thank you for the interview!

Also checkout: http://www.tipi.camp/site/index.xhtml#blog, twitter: @TipiDotCamp and demo.campground.website

Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - February 24, 2015 05:44 PM
From Sublime to NetBeans?

What if Sublime were to be less cool than you thought and what if NetBeans were to be faster than you've assumed it to be? Right-clicking on an HTML file on disk and then opening it into Sublime takes 1 second, while with NetBeans IDE 8.0.2, if you're using the small HTML5 & PHP distribution (which doesn't need the JDK, only the JRE) it takes 9 seconds. Is 8 seconds a very big deal? To me, it sounds like NetBeans is an IDE that is 8 seconds away from being as fast as an editor.

Sure, performance and speed is a lot more than startup time. It's also about how quickly and easily things open and how smoothly you can switch from one task to another. But even here NetBeans has made great strides over recent releases and there's useful plugins like the Sublime feature (in fact, on the NetBeans Plugin Portal there are currently 6 different Sublime plugins) and the One Click Open Sesame feature to make it even more editor-like. Below are two screenshots, on the left of each you see Sublime, on the right you see NetBeans. Click the images to enlarge them and, unless I'm very much mistaken, the difference between them is 8 seconds faster startup time for Sublime, versus heaps of integrated features (which surely are worth waiting 8 seconds for) in NetBeans.

If you haven't tried the small bundle of NetBeans, i.e., the bundle aimed specifically at frontend developers, i.e., the HTML5 & PHP bundle, go here to get it (all free):


One feature I really like in Sublime, and it is also in the JetBrains products, is the multicursor functionality. I.e., you can have more than one cursor, i.e., on multiple lines. Lets you select code in multiple lines and change them at the same time, like rectangular block selection but not limited to a block. Seems like an extremely cool feature to me. However, the question does arise how often one needs that feature versus, for example, code completion for AngularJS directives, with embedded AngularJS documentation, as well as cutting edge KnockoutJS features, and native integration with Git, Gulp, Grunt, Bower, Node.js, Cordova, SASS, LESS, Mocha, Karma, Protractor, and Selenium, as well as integration with the Chrome browser, a library of out-of-the-box samples, and heaps more.

If you're going to respond to this admittedly contentious blog entry, it would really help if you've recently, i.e., over the last 6 months, made heavy use of both Sublime and NetBeans.

Adam Bien - February 24, 2015 02:10 AM
Injecting Thread Pools with Java EE 7 and Porcupine

In this short porcupine intro, I'm going to setup and inject a thread pool (ExecutorService) of Java EE 7 managed threads and expose the corresponding statistics via JAX-RS.

Porcupine is also used in hellsockets.

See also other screencasts at: http://tv.adam-bien.com or subscribe to http://www.youtube.com/user/bienadam.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting

Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - February 23, 2015 07:27 PM
YouTube: Search Everywhere in NetBeans IDE

What do you do when you don't know how to do something in NetBeans IDE? Do you search through random menu items? Do you go to Google and StackOverflow and mailing lists? Do you search through tutorials? What do you do? In this short YouTube clip, you'll learn about a feature you probably didn't know about or might soon look at in a different way.

While making the above, I realized I need to work a bit more on the Key Promoter plugin since not everything of interest I do with the keyboard is currently shown in the toolbar, yet.

APIDesign - Blogs - February 22, 2015 12:44 PM
ConfigurationObject Pattern in Java

ConfigurationObject pattern is quite common in many JavaScript libraries. Do you know what is the best way to express it in Java? Check my essay that compares four different ways and analyses their impact on API designer and especially API users.

--JaroslavTulach 12:44, 22 February 2015 (UTC)

Adam Bien - February 22, 2015 11:05 AM
hellsockets: The Java EE 7 WebSocket Stress Generator

During the recent airhacks workshops an attendee asked me a question about websocket stress testing tools.

You could create an own generator with jmeter.apache.org, but the websocket protocol is not directly supported.

The first, experimental, version of hellsockets is available. It is based on the built-in Java EE 7 websocket client and porcupine.

Hellsocket is a 23kB WAR which can be installed as drop-in on a Java EE 7 server and was tested on GlassFish / Payara 4.1 and WildFly 8.2. Stress tests can be initiated and the statistics are available via: HTTP/REST.

Feedback is highly appreciated.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting

Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - February 22, 2015 08:00 AM
How to Quickly Create New Java Files

I was looking at the Quick Search field a few days ago with a programmer friend and we were also discussing the New File dialog and how clunky it is to find how to create new Java source files there. So I thought, why not integrate relevant templates from the New File dialog into the Quick Search field?

Here's the result, i.e., notice that when I type "java", I can see (for the first time thanks to this new plugin I created) various Java file templates are available which, when clicked below, cause the relevant New File dialog to appear, all filled out with the values of the currently selected project. If no project is selected, or a file within a project, a message appears informing you of that requirement, since Java files need to be created within projects.

Source code:


Geertjan's Blog - February 21, 2015 08:49 PM
Greenfoot and NetBeans (Part 2)

Recently I wrote about Greenfoot and NetBeans. Since then, Michael Kölling and his team have been working hard on simplifying the steps of moving a Greenfoot project to NetBeans. I tried out his simplified instructions today, with a build of a new release of Greenfoot, and found that in the previous blog entry, step 4 and 5 are no longer needed.

When you want to open a Greenfoot project into NetBeans, start by using the "Java Project with Existing Sources" wizard (in the New Project wizard, Ctrl-Shift-N) to import the project. For example, the "lunarlander" project, which comes with Greenfoot, looks as follows in NetBeans:

As described in the previous blog entry, you need to put "bluejcore.jar" and "greenfoot.jar" on the classpath of the project, as you can see above.

Next, right-click the project and choose Properties. In the Run tab of the Project Properties dialog, define the following (click to enlarge the screenshot below):

As you can see in the screenshot above, you need to the working directory to the root folder of the project. And, as you can also see above, you need to run "greenfoot.export.GreenfootScenarioMain" with three arguments, with no commas between them:

  • Scenario name.
  • Name of the world class (just the name, no .class extension).
  • Path to the 'greenfoot-labels' file from the Greenfoot installation (lib/english/greenfoot/greenfoot-labels).

Following the above steps, there's no need to create a properties file, which was defined in the previous blog entry, i.e., if the "greenfoot-labels" file is available.

Then run the project and you should see that it works perfectly, no need to fiddle with images and resources either, they're now found automatically:

markiewb's blog - February 21, 2015 05:47 PM
NB platform: Catching missing resources at compile-time using @StaticResource

When you develop a NetBeans platform application sometimes you like to refer to existing resource files like images.

Therefor you have to hard-code the path into your sources in a string literal. Normally you would notice a wrong path at runtime because of a FileNotFoundException – not very professional.

But wait! Use the org.netbeans.api.annotations.common.StaticResource-annotation from the Common Annotations module (/org.netbeans.api:org-netbeans-api-annotations-common) instead. Backed by an annotation processor NetBeans will check whether the path is correct at compile-time. This is pretty cool.

What do you get? NetBeans shows missing resources in the editor, in the “Action Items”-view and even the build will fail.


[1] http://bits.netbeans.org/8.0/javadoc/org-netbeans-api-annotations-common/org/netbeans/api/annotations/common/StaticResource.html

Java Evangelist John Yeary's Blog - February 21, 2015 01:04 AM
JSF 2.x Tip of the Day: Implementing a ViewMapListener

A map of the lands where the Trobadors flourished. 
"France 1154-en" by Reigen - Own work
Licensed under CC BY-SA 4.0 via Wikimedia Commons.


There are a number of SystemEvents supported by JSF 2.x. A question that comes up frequently is how to implement them. In a number of cases on stackoverflow, it is implemented using a PhaseListener. I was looking for a way to cleanup the view map, or just get values from it before it was destroyed. I decided that the simplest way to do so was to implement a ViewMapListener. I also noticed that there were very few posts on how to implement it using the faces-config.xml so I decided to use that approach since it was instructive and more clear to me.


The basic implementation requires that you add our listener implementation to the faces-config.xml. The example I have here is designed to get called on a PreDestroyViewMapEvent which is called on a normal navigation. We can force it though by adding a @PreDestroy annotation to a method to invoke before being destroyed. Inside the method we would need to get the UIViewroot view map, and call clear(). This would cause our listener to be invoked too. It would be a good cleanup mechanism for cleaning up resources on session expiration too, but at the moment this does not work on JSF 2.1. The @PreDestroy is not called on session timeout on JSF 2.1. This is expected to be an enhancement in JSF 2.2+.

The code for the project can be downloaded from Bitbuket here: viewmaplistener-example




The example above is just one mechanism of using a SystemEvent listener. You may decide to read values from the map, and add them to the session, or manipulate it in some other way before the data is destroyed.

Adam Bien - February 20, 2015 04:39 PM
Headlands "Payara" Release Is Available

Headlands exposes JCache API via REST and uses hazelcast.org as default JCache implementation.

The Payara server also comes with JCache support and with built-in Hazelcast. The recent Headlands release is also available without hazelcast and jcache libraries. The WAR headlands.war is skinnier and comes with 56 kB.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting

Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - February 20, 2015 08:00 AM
Sublime Text and NetBeans

Here's Sublime:

And here's NetBeans:

It pays to have both these tools in your toolbox. Switching between them is no problem. You can have them open at the same time, changes made in one are picked up by the other immediately. NetBeans is certainly significantly more powerful and expressive, look for example at the difference between code completion above.

Note: A common stumbling block is that when front-end developers go to the NetBeans Downloads page, they download the "All" distribution. The smart move is to download the "HTML5 & PHP" distribution instead. It is significantly smaller and lighter. Whenever a front-end developer has mentioned that they find NetBeans to be heavy and resource intensive, it has turned out that the developer was not using the "HTML5 & PHP" distribution. They were either using "Java EE" or "All" instead, both of which are the wrong distribution if you're "only" doing front-end development.

A question you might have is what's the difference in the size on disk of these two tools. Well, let's turn the question around and ask what's the value of having a JavaScript debugger built into your tool for stepping your code? And what's the value of having Git, Mercurial, and Subversion integration and local versioning support built directly into it? Don't you need those tools, and many others just like it, baked into the tool you're using, i.e., tested and naturally fitting into your development tool? Then what's the relevance of one tool taking up more or less space on your disk if in exchange for slightly more disk space you get the tools that you're going to need to install anyway if you're going to use the other tool?

And what's the value of being able to do this:

And this:

And this:

In short, these two are great to use together for frontend development. Want to do some quick editing, use Sublime. Want to do some more comprehensive tasks, e.g., smoothly set up an AngularJS project from scratch and check it into your GitHub repo, in a matter of two or three clicks, and then deploy the app to Android, debugging and styling it live there? Use NetBeans.

Geertjan's Blog - February 19, 2015 07:29 PM
Tools for Teachers: Key Promoter for NetBeans

I wanted to be able to see the key events I'm typing or pressing in NetBeans IDE. So I created the Key Promoter plugin for NetBeans IDE. Helpful for me, and anyone else, using NetBeans IDE to teach anything at all, or do demos in NetBeans IDE, because the students/audience, whoever they are, can see what you're doing. Seeing the keyboard shortcuts you're doing helps confirm to your audience, and even lets them quickly take note of what you're doing, also because often they won't hear exactly the key combination as you're using it and talking about other things at the same time.

For the first time, the color of the label can now be changed (directly in the toolbar and not in some small place in the Options window), which is handy when you switch between different color schemes, themes, and look and feels.

In the above screenshot, I could potentially be saying: "NetBeans IDE lets you select a block of code across lines when you press Ctrl-Shift-R, as I am doing right now, as you can see in the toolbar, after which a block of code can be selected and changed simultaneously."

Get it here:


Adam Bien - February 19, 2015 05:43 AM
"Can not execute..." sonar-maven-plugin error and solution

The error after execution of mvn sonar:sonar: "Can not execute SonarQube analysis: Please update sonar-maven-plugin to at least version 2.3" can be fixed by forcing maven to use the recent version in pom.xml


The error happens after upgrade to: Sonar 5.0. The Sonar 5.0 requires a >2.3 recent version of the sonar-maven-plugin which does not come as default.

Real World Java EE Workshops [Airport Munich]>

DukeScript - February 18, 2015 11:53 AM
Testing Network Communication with DukeScript

Since the post on Test Driven Development in DukeScript we know that DukeScript is excellent when it comes to testing the UI behavior. However a typical DukeScript application not only shows a UI, but also talks to a server. This post is going to explain how easy is to mock such server communication and make it fully unit testable.

@OnReceive with Plain Text

The DukeScript network communication is typically done with the help of the @OnReceive annotation that is provided as part of HTML/Java API. It has been carefully designed to express intentions with as little Java code as possible. Handling an asynchronous REST call and processing its result fits in the following twelve lines:

@Model(className = "Data", properties = {
  @Property(name = "message", type = String.class),
final class DataModel {
    @OnReceive(url = "{protocol}://{server}/{path}")
    static void readMessage(Data model, String data) {
    @ModelOperation static void obtainMessage(Data model) {
        model.readMessage("https", "api.github.com", "users/dukescript/repos");

The question, of course, is how do we test the behavior of such a method without really connecting to the server? Luckily, every API in the DukeScript ecosystem comes with an SPI which allows us to create a mock implementation and inject it in the Test:

import java.io.IOException;
import java.io.InputStream;
import net.java.html.BrwsrCtx;
import net.java.html.json.Models;
import org.netbeans.html.context.spi.Contexts;
import org.netbeans.html.json.spi.JSONCall;
import org.netbeans.html.json.spi.Transfer;
import static org.testng.Assert.*;
import org.testng.annotations.Test;

public class DataModelTest {
    @Test public void plainTextRESTCall() {
        class MockTrans implements Transfer {
            public void extract(Object obj, String[] props, Object[] values) {
                fail("Not implemented");

            public Object toJSON(InputStream is) throws IOException {
                fail("Not implemented");
                return null;

            public void loadJSON(JSONCall call) {
                assertFalse(call.isJSONP(), "Regular JSON call, not JSONP");
                assertEquals(call.composeURL(null), "https://api.github.com/users/dukescript/repos", "The expected URL queried");
                call.notifySuccess("Mocked reply!");
        MockTrans mock = new MockTrans();
        BrwsrCtx ctx = Contexts.newBuilder()
            .register(Transfer.class, mock, 1)
        Data data = Models.bind(new Data(), ctx);
        assertEquals(data.getMessage(), "Mocked reply!");

The test basically checks whether -after calling method obtainMessage- the application connects to the specified server URL and then uses the reply as a value of its own message property.

To do that check (and to avoid connecting to a real server), we register our own implementation of the SPI interface Transfer. The implementation is registered into the BrwsrCtx, and our Data instance is then bound to the context. As a result our MockTrans implementation is injected into the Data instance and used whenever the instance needs to perform a network operation.

Our MockTrans implementation handles only the loadJSON method and checks its input parameters and also verifies the correctness of the passed in URL. The mock implementation then completes the network operation by calling the notifySuccess method. Usually the call to notifySuccess is asynchronous, but for unit testing, it is more handy to make it synchronous. Like this we can check the value of data.getMessage() immediately after returning from the obtainMessage call.

Testing network communication is so easy with DukeScript!

Type-safe Access to Received JSON Data

As we discussed in our blog entry on type-safe parsing the biggest power of the DukeScript APIs is enabling type-safe access to JSON structures. Rather than accepting simple text we can define a Repo model class and let the @OnReceive method do the parsing automatically. Here is the improved example that defines an additional Repo model:

@Model(className = "Data", properties = {
  @Property(name = "message", type = String.class),
final class DataModel {
  @Model(className = "Repo", properties = {
    @Property(name = "name", type = String.class),
    @Property(name = "id", type = int.class)
  static class RepoModel {
  @OnReceive(url = "{protocol}://{server}/{path}")
  static void readMessage(Data model, Repo data) {
  @ModelOperation static void obtainMessage(Data model) {
    model.readMessage("https", "api.github.com", "users/dukescript/repos");

How can we mock such a network communication with parsing in a test? The approach is the same, but we need to also implement the extract method and make sure the value passed to notifySuccess can be understood by the extract method as well. Here is the code of our new testing method:

@Test public void jsonRESTCall() {
    class MockTrans implements Transfer {
        public void extract(Object obj, String[] props, Object[] values) {
            assertEquals(props.length, 2, "Repo model class has two properties");
            assertEquals(values.length, 2, "Repo model class is requesting two values");
            assertEquals(props[0], "name", "Name of first one is 'name'");
            assertEquals(props[1], "id", "Name of second is 'id'");

            List<?> notifySuccessData = (List<?>)obj;
            values[0] = notifySuccessData.get(0);
            values[1] = notifySuccessData.get(1);

        public Object toJSON(InputStream is) throws IOException {
            fail("Not implemented");
            return null;

        public void loadJSON(JSONCall call) {
            assertFalse(call.isJSONP(), "Regular JSON call, not JSONP");
            assertEquals(call.composeURL(null), "https://api.github.com/users/dukescript/repos", "The expected URL queried");
            call.notifySuccess(Arrays.asList("Mocked Repo Name", 42));
    MockTrans mock = new MockTrans();

    BrwsrCtx ctx = Contexts.newBuilder()
        .register(Transfer.class, mock, 1)

    Data data = Models.bind(new Data(), ctx);
    assertEquals(data.getMessage(), "Mocked Repo Name");

We use List to hold the data passed from notifySuccess and extract it in the extract method after verifying that we are really queried for two properties in the order specified when declaring the Repo model class.

And that’s all. The rest of the test remains the same.

Dealing with JSON Arrays

Of course, if you click at the real REST URL you find out it returns an array of JSON objects. So we should also modify our code to accept a list of Repo instances:

@OnReceive(url = "{protocol}://{server}/{path}")
static void readMessage(Data model, List<Repo> data) {

What needs to be changed in the test? Almost nothing: just call the notifySuccess method with an array of objects! The internal infrastructure will recognize the array and do the necessary processing itself:

public void loadJSON(JSONCall call) {
    assertFalse(call.isJSONP(), "Regular JSON call, not JSONP");
    assertEquals(call.composeURL(null), "https://api.github.com/users/dukescript/repos", "The expected URL queried");
    call.notifySuccess(new Object[] {
        Arrays.asList("Mocked Repo Name", 42),
        Arrays.asList("Another Mocked Repo", 84)

Done. We can now use TDD to verify the network communication of our DukeScript based application in unit tests.

Good luck creating your own portable, robust applications in Java!

Geertjan's Blog - February 18, 2015 08:00 AM
Listening to Key Events in NetBeans IDE

Here's how to detect whether the user has pressed Ctrl-Tab. Add the following code within a Runnable annotated with @OnStart, in the "run" method implementation:

KeyboardFocusManager keyboardFocusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
keyboardFocusManager.addKeyEventDispatcher(e -> {
  KeyEvent kev = (KeyEvent) e;
  if (kev.getModifiers() == InputEvent.CTRL_MASK && kev.getKeyCode() == KeyEvent.VK_TAB) {
       StatusDisplayer.getDefault().setStatusText("you pressed ctrl-tab");
  return false;

The import statements:

import java.awt.KeyboardFocusManager;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import org.openide.awt.StatusDisplayer;
import org.openide.modules.OnStart;

Adam Bien - February 18, 2015 06:35 AM
Note On Polyglot Programming

Polyglot programming is the idea to use in a single project (application or script) multiple programming languages at the same time. "Use the right language for the job" is often referred as the main driver behind this movement. Productivity increase is the overarching goal, justified by disjoined qualities of special purpose programming languages.

In "best case" you would use one programming language for the data access, another one for data transformation and a completely different language for efficient message passing between the processes. On top of this mix you will have to use SQL, CQL, JPA-QL (...), CSS (Sass / Less), JavaScript / JSON, HTML and probably some native languages for the UI technology anyway.

Now lets assume the project survives the development, is successful and is going to be maintained for several years.

  1. How many developers are able to master several languages at the same time to maintain the system efficiently?
  2. How much time are you going to spend in meetings to discuss what the best language for the job actually is?
  3. How likely is it, that all the chosen languages remain popular and well maintained through the lifecycle of the application?
  4. How many IDEs are you going to need to maintain the whole system?
  5. How easy it is to create a Continuous Integration pipeline for all the languages, but one system at the same time
  6. Did the complexity really decreased and the maintainability increased?
  7. How interoperable are theses languages?
  8. What about debugging, profiling, bug fixing? Is a language mix in the same callstack easier to tackle?

What's funny: "Polyglot Programming" seems to be a nice topic for a conference session, at the same time most "real world" projects try to be the opposite. nodejs is often chosen by JavaScript frontend developers as backend framework, because it is JavaScript. Isomorphic is even hotter and completely contradicts the idea of "polyglot" programming.

GWT on the other hand, is still popular among Java backend developers, because they can build the frontend ...in Java.

Usually not the technology, rather than annoying client's requirements are the productivity break :-)

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting

Real World Java EE Workshops [Airport Munich]>

Michael's blog » NetBeans - February 17, 2015 09:22 PM
NetBeans Day in Germany

On this page you may get a free ticket for the NetBeans Day in Germany on March 16th 2015 [1]. At the time of this writing, only 12 tickets are remaining. [1] www.eventbrite.com/e/netbeans-day-germany-tickets-3604367761