Skip to main content

How to start writing apps for TiVO in NetBeans, in 5 minutes or less

Posted by timboudreau on February 4, 2005 at 1:07 PM PST

The
TiVO
folks have a Java SDK for writing
applications that run on a TiVO (well actually the code runs on the server, and
the visualization happens on the user's TV), along with a simulator that lets
you run and debug applications on your computer. Here's how to very simply set
up NetBeans to run/debug TiVO applications.

These instructions are for a current NetBeans 4.1 development build, but the
process is very similar for NetBeans 4.0.

First, you will need to download the
TiVO SDK
,
and unpack it to, e.g.,

/tivo

Now, in NetBeans:

  1. Select
    File | New Project
    to open the New Project Wizard.
  2. Select the
    General
    category in the left-hand pane, and
    Java Application
    in the right-hand pane, and press
    Next
    .

    On the next pane of the wizard name the project

    TivoTest
    , and press
    Finish
    to create the project.
  3. Right click the
    TivoTest
    node in the
    Projects
    tab of the
    Explorer
    window (to the left of the editor) and
    choose
    Properties
    from the popup menu that appears, to show the
    Project Properties dialog.

  4. Select the
    Build | Compiling Sources
    node in the left-hand pane of that
    dialog, and
    Click the
    Add Library
    button on the right. This displays a list of
    libraries NetBeans already knows about. If this is the first time you've used
    the TiVO SDK, you'll need to set it up as a library; otherwise,
    steps 5 through 7 can be skipped.
  5. Click the
    Manage Libraries
    button
    in this dialog. In the next dialog, click
    New Library
    at the bottom left.
    In the New Library dialog, type
    Tivo
    and press enter
    to close the dialog.
  6. The Library Manager dialog will now show a new library on the left called
    Tivo, with no contents. Click the
    Add Jar/Folder
    button on the left.
    In the file dialog that appears, navigate to wherever you unpacked the
    TiVO SDK. Select
    hme.jar
    and
    simulator.jar
    , and press the
    Add JAR/Folder
    button at the bottom of the file dialog to accept
    them.
  7. Now switch to the
    Sources
    tab, and click its
    Add JAR/Folder

    button, and add
    src.zip
    , so javadoc comments will be visible with
    code completion for the TiVO SDK classes.
    Future projects can simply be pointed at the library which
    you have just created.
  8. Click the
    Add Library
    at the bottom of the Add Library dialog button
    to add the new TiVO library to your project. Click
    OK
    to close the
    Project Properties dialog.
  9. Now that all the dialogs are closed, you should be looking at the

    Main
    class that was generated by the New Project
    Wizard. Change the superclass to be
    Application
    .
    Press Alt-Shift-F (Ctrl-Shift-F on Macintosh) to
    auto-import
    com.tivo.hme.sdk.Application
    , the superclass.
  10. Insert the following code into the
    Main

    class (don't delete the
    main (String[] args)
    method!):
        protected void init(Context context) {
            root.setResource(createText("default-36-bold.font",
                Color.white, "Hello from an application!"));
        }
  11. Now just insert the following line in the existing
    main (String[] args)
    method:
        Simulator.main(new String[] {Main.class.getName()});

Press F6 to run the app, press F5 to debug it.

For anybody interested, they appear to be running a
developer contest
.

Now if there were just something on TV aside from plastic surgery, car makeovers and Law and Order...is it just me or did American television go completely insane over the five years I was living overseas?