How to open NetBeans project from web in the IDE

NetBeans 5.5.1 and later contain functionality that allows you to easily share code samples and NetBeans projects over the internet. Just create a ZIP file of your project or projects and make it available from anywhere on the web, then create a URL with the parameters listed below. A Java WebStart application will launch that looks for a suitable build of NetBeans on the user's machine, opens the IDE, extracts the project to where? , and opens the projects in the IDE. You can use this for your blog entries, tutorials, or anything else. It's like the YouTube of Java sample code!

How It Works

The IDE uses the command line interface (CLI) of NetBeans launcher to open projects from the web. The CLI of the launcher can be used to open a project from command line. The command looks like this:

netbeans --open /nb/project/dir/number/one /nb/project/dir/number/two ...

The CLI is used by the WebStart application that downloads projects from web and then opens them in the IDE.

Preparing the Project Archive File

You can open one project or several at one time, for example some suite of projects like an enterprise application or a desktop app and its library projects. To open several projects at once, all projects must be zipped to one zip file. Projects can be also nested inside other projects. Projects must be archived without the nbproject/private folder, as this folder contains files with absolute paths and other non-sharable data. For creating the zip file you can use the ProjectPackager module from If you are going to zip projects by hand, the best way is to copy them all to some folder (make sure you don't break dependencies by copying them), delete 'nbproject/private' folder from all projects and then zip them up. Project folders should be the top-level folders in the zip file (except for nested subprojects, as in Java EE applications).

A Couple of Hints

  • If there are any dependencies on other jars put them under project folder, e.g. under folder libs
  • If there are any dependencies on other projects put them all under one folder and then create those dependencies
  • Delete nbproject/private folder before creating the zip archive. The folder contains files with absolute paths references, it means that they are not sharable.
  • Project name should be the same as project folder, to avoid problems when processing downloaded projects
  • Make the project use the default platform, it means the platform which IDE runs on (there is usually Default next to the name of
 the platform in the project customizer). The platform definition is specific to computer where the project was created and project 
 using non-default platform would not be sharable.
  • Run Clean Project action before creating the archive, final zip file will be smaller.

Creating the URL and Publishing

When the zip archive is ready, it must be placed on an HTTP server accessible from the internet so that you have the public URL of the zip file. There are three parameters that can be passed to the application via the URL:

  1. projecturl ... URL (including protocol - http://) of the zip archive file, URL must be correctly encoded; This is the only required parameter.
  2. minversion ... minimum version of NetBeans IDE that can open the project, use only number version.
  3. mainproject ... path to the main project dir in the zip file, separator is '/'

Note that the open project functionality is available from NetBeans version 5.5.1 which is also the fallback version if no version is specified in the URL.

Setup the URL as the following:
  [[URLOfTheZipFileWithProjects | URL of the zip file with projects]]&minversion=[MinimumVersionOfNetBeans]

If any project is supposed to be opened as main project you need to add one more parameter to the URL:


Final URL might look like this (but all on one line):

A Couple More Hints

  • Verify on your machine that the specified version of NetBeans IDE is able to open the project(s). By doing so, you won't leave your users disillusioned.
  • List all special requirements for the NetBeans IDE (e.g. mobility pack required) on the web site where projects will be published.


The application logs all its actions to a log file called projectopener.log in the temp dir. For Unix platforms it's usually /tmp folder, for windows it's usually C:\Documents and Settings\{username}\Local Settings\Temp (or its localized equivalents).

What Happens After a User Clicks the URL?

Opening project from URL is based on Java Web Start technology. When a user clicks the link, a new JNLP file is generated with the parameters passed from the URL translated to arguments for the application. The JNLP client on the user's computer downloads the JAR file of the application specified in the JNLP file and executes its main class. The main class processes the passed arguments and if everything is OK it starts to download the project ZIP file. If the download is successful, it starts looking for the proper NetBeans IDE installation by searching the .netbeans folder in the user's home dir. If a correct installation is found, then the IDE is started and the project folders are passed to it. There might be lots of unexpected situations, e.g. wrong parameters, bad proxy settings, failed download, no NetBeans IDE installation found, etc. - all these situations are handled by error messages or dialogs. If the application encounters an unrecoverable problem, the application is terminated.

Sample Link

To try out the opening of project in NetBeans IDE, you can click the following link. It will open dummy project which can be immediately executed by pressing F6:

Open dummy test project in IDE

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