Over a million developers have joined DZone.

Starting with the Pivot Starter Kit in NetBeans IDE

DZone's Guide to

Starting with the Pivot Starter Kit in NetBeans IDE

· Java Zone ·
Free Resource

Download Microservices for Java Developers: A hands-on introduction to frameworks and containers. Brought to you in partnership with Red Hat.

The Pivot Starter Kit that was announced today is really a cool thing. A complete demo application for newbies to Pivot. I downloaded it and imported it into the IDE (a.k.a. 'I opened it as a free-form project'):

Note: The code in the two files shown above is listed in the Pivot Starter Kit announcement on Javalobby.

I used a free-form project because the demo application comes with its own build.xml file. (A different approach would have been to open the demo application as a 'Java Project with Existing Sources' and to then copy the demo's build.xml over the one created by the IDE.) Here's the free-form project template:

When you're clicking through the wizard and selecting your sources, you can also map project commands to Ant targets from the demo's build.xml file:

To be able to use the IDE's editor features, you also need to register the demo app's libraries in the project's Properties dialog:

Then add a run target, which the demo app's build.xml doesn't provide:

<target name="run" depends="build">
    <java classpathref="project.class.path" classname="pivot.wtk.DesktopApplicationContext">
        <arg value="pivot.starter.StarterApplication"/>

You can now right-click the project and choose 'Clean', 'Build', and 'Run', which will call the Ant targets in the build.xml file.

Finally, run the application and you'll have this:

Or run the application as an applet (note the 'draggable' parameter below, for JDK 6 Update 10, in a browser to which that applies, such as FireFox 3):

<title>Pivot Starter Application</title>
<body style="margin:0px; padding:0px">
<applet code="pivot.wtk.BrowserApplicationContext$HostApplet"
width="100%" height="100%">
<param name="applicationClassName" value="pivot.starter.StarterApplication">
<param name="image" value="spinner3-bluey.gif">
<param name="centerimage" value="true">
<param name="boxborder" value="false">
<param name="draggable" value="true">

In both cases, when you click the button, you get this response (below in an applet):

Then, now that you have your sample up and running, continue your journey into Pivot by taking the Pivot tutorial!

Download Building Reactive Microservices in Java: Asynchronous and Event-Based Application Design. Brought to you in partnership with Red Hat


Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}