Over a million developers have joined DZone.

Using Maven and IntelliJ IDEA to Create NetBeans Platform Applications

· Java Zone

Discover how powerful static code analysis and ergonomic design make development not only productive but also an enjoyable experience, brought to you in partnership with JetBrains

I'm creating a NetBeans Platform application called "Adito Designer", which is used to customize the main application, named "Adito" (a customer-relationship management software). By "customizing" I mean defining how things work in Adito and what is shown in Adito. For example, you can set up frames in Adito by dragging buttons and textfields onto a workspace in the Adito Designer and by writing Javascript to define what exactly happens when something interacts with something else. Besides that, a lot of configuration can be done in Adito Designer, by choosing and setting up the database for defining localizations. So, Adito Designer is pretty much similar to NetBeans IDE. It's an application for creating an application. It's not as universal as NetBeans IDE, though, but there are many intersections.

While that application already existed as a Swing application, it got pretty large and hard to maintain, with a few "I-hope-I-never-have-to-touch-this-again-areas", as well as being difficult to extend. So it got time for a fundamental reconstruction. After a few weeks of examining possible frameworks, the NetBeans Platform was chosen, for various reasons. A prerequisite was that the framework had to be usable within Intellij IDEA, since we have been using that IDE here for 8 years now. Asking Aunt Google soon brought me to this article on NetBeans Zone , as well as this blog entry. After some tests, it was found that our requirements could be easily archieved via Maven. As a bonus, I got dependency management and a defined project structure.

So, speaking of Maven. Maven is great and the NBM plugin for Maven for packing your NetBeans Platform project is great, too. It simply works. But, using Maven, it seems that the only way to run your application is by firing up a Maven build, which then runs through all your modules, checks whether something changed for compilation, compiles, then (no matter what) rebundles the modules as ZIP and then (after only 30 seconds) starts your application. Looking at this article again on NetBeans Zone, I got the impression that there must be a better way. So I ended up writing a simple starter:

import org.netbeans.Main;

import java.io.File;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

public class NbpStarter

private final static String WORKDIR = "myapp/target/";
private final static String DEPLOY = WORKDIR + "myappname/";

public static void main(String[] pArgs) throws Exception
System.setProperty("netbeans.logger.console", "true"); // for logging on the console
System.setProperty("netbeans.user", WORKDIR + "userdir"); // settings are stored here
System.setProperty("netbeans.home", DEPLOY + "platform11"); // the netbeans cluster.

System.setProperty("sun.awt.keepWorkingSetOnMinimize", "true"); // maven set this per default on starting

String[] fixedArgs = {
"--branding", "myappname"

LinkedList list = new LinkedList();

// cleanup usercache (otherwise problems arise. cache seems to be not written correctly).


private static String[] _listToArray(List pList)
return pList.toArray(new String[pList.size()]);

private static void _deleteUserCache()
_delete(new File(WORKDIR + "userdir/var/cache"));

private static boolean _delete(File pPath)
if (pPath.exists())
File[] files = pPath.listFiles();
for (File file : files)
if (file.isDirectory())
//noinspection ResultOfMethodCallIgnored
return (pPath.delete());


Suddenly I was able to start my NetBeans Platform application just by hitting the "Run" button in IntelliJ IDEA! Debugging worked like a charm, too. The last problem I had was branding. Adding "myapp/target/myappname/myappname/core/locale" and "myapp/target/myappname/myappname/modules/locale" to the classpath of the starter solved that problem as well.


Learn more about Kotlin, a new programming language designed to solve problems that software developers face every day brought to you in partnership with JetBrains.


The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}