bitrazor.com ...THE source for mediocre content                                      

TiVo HME How-To: Create a JAR             

If you have a bunch of Eclipse Projects, you may want to create a .jar file out of one or more of them, if they're not changing much.

  • Select the project (e.g. Project1) in Eclipse, then do File - Export - JAR File.  The default selections are OK.
  • When naming your JAR file, it's considered good form to include a version number, e.g. regionmaster-1.0.jar .
  • If you have other projects (e.g. Project2) that had a Project Reference to this project, you can remove the project reference and Add External JAR.  However, make sure that Project2 also has all of the same External JAR references that Project1 did or you may get weird exceptions at runtime.

Search the Eclipse help for 'create jar' for more info.

Creating a JAR Manually

This uses the example HelloWorld application, and shows what to put in the manifest.

Bring up a command window (Start - Run - cmd - <enter>), and change directory to the root of the HelloWorld Eclipse project.

Change your manifest file to look like this:

Manifest-Version: 1.0
Class-Path: hme-host-sample.jar hme.jar
Main-Class: com.tivo.hme.host.sample.Main


Save the file as mymanifest in that same directory.

Copy the hme.jar and hme-host-sample.jar files from the SDK into this directory as well.

Run the following command to create the JAR:

jar cvfm HelloWorld.jar mymanifest com\tivo\hme\HelloWorld.class

(jar.exe may be found in the bin directory of your Java SDK, e.g. C:\j2sdk1.4.2_07\bin, if it's not in your PATH)

Run the JAR using this command:

java -jar HelloWorld.jar com.tivo.hme.HelloWorld

You should get the telltale output letting you know it's running:

HME SDK 1.4 (TiVo, Inc.)
LOG: added factory
MDNS:
http://192.168.1.100:1412/hme/
 

 

                                                         Last updated: February 19, 2007