Penlets.com provides resources for users and developers of the Pulse smart pen from LiveScribe.
Subscribe: RSS Feed - Developers Group
Tutorial
Developing Penlets in Eclipse
Tutorial by Robert HansonIn this tutorial we are going to explain how to set up Eclipse to develop penlets. At the time of this writing only the JavaOne SDK is available, so the tutorial will be based on that. The good news is that this is relatively easy to do, so we should have you up and running in a ten minutes.
Whoa! What about the PreRelease-SDK? If you are using the PreRelease-SDK, it ships with an Ant build script that will automate all of this for you. You can find the instructions in the README-Eclipse.txt file that ships with the SDK. If on the other hand you rather run through the steps manually, this tutorial still applies.
In Eclipse you start by creating a new project, and creating the
following directory structure. The
/src/images
directory is option. It is only needed if you plan on displaying
images on your pen's display, which we cover in a
separate tutorial.
/src/java /src/images /res
in the
/res
directory you will need to create two text files,
config.txt
and
menu.txt
. You should consult the documentation that came with the SDK for the
contents of these files, but if you are in a rush the typical case is
that
config.txt
is left empty, and
menu.txt
looks something like the example below. The
menu.txt
file is used to configure how your penlet appears in the pen's menu
options. This one is from our
Image Demo
application.
name=Image Demo type=APP appclassname=com.penlets.graphics.ImageDemo sound=
Next, at the root of the project, you will need to add a
build.properties
file. This file contains information needed to build the JAR file for
the penlet being developed. Again, consult the SDK documentation for
the details, but here is the one used by our
Image Demo
application.
# Build Properties for the Application app.name=Image Demo app.version=1.0.0 app.penlet.class=com.penlets.graphics.ImageDemo app.vendor.code=Penlets app.vendor.name=Penlets.com
The last file to add to the project is the
build.xml
file, which is placed at the root of the project. This is an Ant
build file that is generated when you create a penlet project in
NetBeans, using the plugin provided with the SDK. You can use this
build file-as is with one exception, you must set the
PENLETSDK_HOME
to the
penletsdk
directory under where you unzipped the SDK distribution. The SDK
contains a much larger Ant script, containing all of the build
targets, that this one will include.
<?xml version="1.0"?>
<project name="My Project Name" basedir="." default="dist">
<property name="PENLETSDK_HOME" location="C:\LivescribeJavaOneSDK-1.0\penletsdk"/>
<property name="common.builddir" value="${PENLETSDK_HOME}/build" />
<property name="java.src.dir" value="src/java"/>
<import file="${common.builddir}/build-common.xml" optional="false" />
</project>
The last step is to configure the build path for your project. When you open up your build path dialog in Eclipse, under the Libraries tab you will undoubtedly see your Java SDK, typically for Java 5 or Java 6. Remove this! This might seem wrong, especially for a Java project, but this is the right thing to do in this case. The Pulse Pen only supported a micro Java SDK, and the LiveScribe SDK already contains all of these standard Java classes.
With your Java SDK removed, you need to add the Livescribe SDK
classes. This is located in the unzipped SDK, under
/penletsdk/lib/classes.zip
. It should look like what you see below.
That is it. In Eclipse when you right-click the
build.xml
file and select
Ant Build...
you will see all of the available targets. This will allow you to
build, package, deploy and undeploy your application from the pen.
Happy coding!
Comments (View) blog comments powered by DisqusProject Information
Tested for use with: JaveOne-SDK, PreRelease-SDK
New Tutorials
Using a Shared Library
Learn how to create a library of utils that you can
share between projects.
Capturing Drawn Shapes
Learn how to capture shapes drawn by the pen and determine relationships.
Penlets 101
Never written a penlet before? Then start here with Penlets 101!
Creating a Custom Vocabulary
Learn how to create a custom vocabulary for your ICR applications.
Using Properties Files
J2ME lacks a Properties class. In this tutorial we roll our own,
along with split and chomp functions.