TiVo people use the Java SDK to write applications that run on the TiVo (actually the code that runs on the server and visualization on the user's TV), and emulators that enable you to run and debug applications on your computer. Here's how to simply set up NetBeans to run/debug the TiVo application.
These instructions are for the current NetBeans 4.1 development release, but the process is very similar to NetBeans 4.0.
First, you need to download the TiVo SDK and then unzip it to/tivo or another folder
Now, in NetBeans:
Select File | New project opens new project Wizard.
Select the general category in the left pane, select Java application in the right pane, and then press Next. On the next pane of the wizard, name the item tivotest, and then press Finish to create the project.
Right-click the Tivotest node in the Projects tab of the Explorer window (to the left of the editor) and select Properties from the pop-up menu that appears to display the Project Properties dialog box.
Select Build on the left pane of the dialog box | Compiling the Sources node, and then click the Add Library button on the right. A list of the libraries that NetBeans has learned is displayed. If you are using the TiVo SDK for the first time, you need to set it up as a library, otherwise you can skip steps 5 through 7.
Click the Manage Libraries button in the dialog box. In the next dialog box, click the New Library in the lower-left corner. In the New Library dialog box, type the Tivo, and then press ENTER to close the dialog box.
The Library Manager dialog box now displays a new gallery on the left, called the Tivo, but no content. Click the Add jar/folder button on the left. In the file dialog box that appears, navigate to the location where you unzipped the TiVo SDK. Select Hme.jar and Simulator.jar, and then accept them by the ADD Jar/folder button at the bottom of the file dialog box.
Now switch to the Sources tab, click its Add Jar/folder button, and then add Src.zip so that the code completion is available for the TiVo SDK class. Future projects only point to the library you just created.
Now, switch to the Javadoc tab, click its Add Zip/folder button, add the Hme-javadoc.zip file in the doc directory, and the TiVo SDK class can see the Javadoc annotation. Future projects only point to the library you just created.
Click the Add Library button at the bottom of the Add Library dialog box to add a new TiVo library to your project. Click OK to close the Project Properties dialog box.
After you close all the dialog boxes, you should see the Main class generated by New Project Wizard. Change the superclass to application. The Com.tivo.hme.sdk.Application superclass can be imported automatically by pressing ALT-SHIFT-F (Ctrl-shift-f on Macintosh).
Insert the following code in the main class (do not delete the main (string[] args) Method! ):
protected void init(Context context) {
root.setResource(createText("default-36-bold.font",
Color.white, "Hello from an application!"));
}
Now insert the following line in the existing main (string[] args) method:
Simulator.main (new string[] {Main.class.getName ()});
The complete class will look like the following:
/*
* Main.java
*
* Created on March 22, 2005, 2:46 PM
*/
package tivotest;
import com.tivo.hme.sdk.Application;
import com.tivo.hme.sim.Simulator;
import java.awt.Color;
/**
*
* @author Brian Leonard
*/
public class Main extends Application {
/** Creates a new instance of Main */
public Main() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Simulator.main(new String[] {Main.class.getName()});
}
protected void init(Context context) {
root.setResource(createText("default-36-bold.font",
Color.white, "Hello from an application!"));
}
}
Press F6 to run the application and press F5 to debug the application.