How to run and distribute my GUI application created in NetBeans?

Matisse GUI builder uses an external library containg various layout-related extensions. You can find the library in the NetBeans' library manager under Swing Layout Extensions name.

The library is added to your project's classpath automatically. When you build the main project, the swing-layout-version.jar file is copied into the dist/lib folder of the project and the built project's JAR is linked with the library JAR (via classpath entry in manifest file) so you can run it just via:

java -jar myproject.jar

To distribute the application, just pack everything under the dist folder. There is also a readme file describing all the details. Note that the project must have a main class set (i.e. represent an executable application), otherwise the dist/lib folder is not created.

If some problem appears, e.g. you get error looking like this:

java.lang.NoClassDefFoundError: org/jdesktop/layout/GroupLayout$Group

then make sure the Swing Extension Library is present in the project's libraries and the project has a main class set. Then rebuild the project.

You can find the library file in the NetBeans installation directory, in case you liked to treat it manually:


If the NoClassDefFoundError persists, try to pack the library inside application jar file (described here).

  Applies to: NetBeans 5.0, 5.5, 6.x
  Platforms: All
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo