# Getting Started with Eclipse



## TiVoPony

Want to write an HME app? Maybe you've dabbled in code before, but never Java. It's not hard, but getting the tools to work is always the first hurdle.

Want to get started? Here's one way, and it won't cost a penny. Note that I won't go into all the why's, but rather focus on the how's...let's get you up and running. 

First, download the following:

The Java SDK 1.42 from java.sun.com

The HME SDK from tivohme.sourceforge.net

The Eclipse IDE from www.eclipse.org

Install/unzip all of that into a set of directories. Doesn't matter where. But remember where you put 'em.

Fire up Eclipse. You'll want to go back to eclipse.org and read through the first couple of sections of the faq, there's a link right on the front page. Work your way down to 'How do I write a "Hello World" program?. Try that...get that working first. It'll show you some of the basics.

Now let's try the same thing with HME.

Create a new project (you should probably go ahead and 'close' your old project by right-clicking on it and selecting 'close'). Name it anything you want. Eclipse will create it, and automatically add the JRE System Libraries to it (standard Java libraries).

Now Right click on the new project (in the explorer window on the left side of the screen), and select Properties. Go to Java Build Path. Select Libraries. Select Add External JARs. Browse and find the files named HME.jar and hme-host-sample.jar in the HME SDK directories. Select both of those, press OK, and Eclipse will add the hme.jar and hme host libraries to the project too.

Create a new package within that project. You can name it whatever you want...our guys use com.tivo.hme, you can use anything, just try to make it unique to you. All lower case. This creates a hierarchy of folders within your eclipse 'workspace' folder, matching whatever you type (eg. empty 'hme' folder inside a 'tivo' folder inside a 'com' folder.

Create a new class within that package. Name it HelloWorld (mind the capitalization, java is picky). Eclipse will create a new class and will auto-fill a bunch of information for you...the start of a program. Select it all, and delete it.

Open up the sample HelloWorld.java app from the HME SDK using any text editor. Copy everything from there into the new class you created in Eclipse (replacing the auto-fill stuff).

Find the line near the top that says 'package com.tivo.hme.samples.HelloWorld'...change it to say 'package xxx.yyy.zzz' where xxx.yyy.zzz is the name you gave your package earlier. All lowercase.

One more thing and you're ready to try and run this thing. You need to copy the icon file from the HME SDK directories to the package. This is easy. Just go to 'My Computer' or 'Windows Explorer' or whatever you use to browse files on your PC. Go to the HME SDK directory you created, and dig through to where the source (src) for the samples are. In the directory called Hello you'll find an icon.png file. Drag that over to the package icon you created in Eclipse. The file will be copied into the Eclipse directories for your java project.

Now, select 'Run' from the menu bar, and scroll down the drop down window and select Run... Don't choose Run As!

A Run window will open. Click on Java Application (to the left), and then press the 'new' button. It'll create a new file labeled 'New_configuration'. Highlight it. This is the runtime configuration for this particular program. Change the Name: to something that makes sense (like HelloWorld). The Project name should be auto-filled. Below that is Main Class. Make sure that 'Include external jars when searching for main class' is checked on. Type the following into the Main class dialog: com.tivo.hme.host.sample.Main.

Now click the 'Arguments' tab (still in the Run dialog window). Under 'Program Arguments' type the packagename.classname (eg. com.tivo.hme.HelloWorld, or xxx.yyy.zzz.HelloWorld). That's the packagename followed by the classname...you need both this time.

Remember to pay attention to capitalization.

Now click 'Run'.

You should see a console window open at the bottom of the screen, and it'll say something like this:

1062ms: Registered http://192.168.3.6:1247/hme/
1140ms: 192.168.3.6 handleHTTP: /hme/icon.png

You can either double click the simulator.jar file in the HME SDK directories, or go to 'Music, Photos & More' on your TCD and view your application. The backdoor for turning on MP&M is clear clear 0 0 on the System Info screen.

If you can get through the above, and you see "Hello World" on your TV...you did it! Now you can focus on learning Java, rather than trying to make the tools behave. 

Cheers,
Pony

edit - updated to reflect the new hosting implementation in SDK 1.3+


----------



## martinp13

Thanks Pony... always nice to have a lantern to help guide you through the swamp!  Can't wait to get home and give this a try.


----------



## dropd

Good job Pony. Eclipse is definitely a nice ide for beginners and experts alike.

I would also recommend creating a second "Run..." configuration where instead of using the "Factory" class as your main executable, you use the "Simulator" class. (Keep the arguments string the same). That way, you can test your app in the simulator with one click, instead of having to start the factory and then launch the simulator from outside eclipse.


----------



## TiVoPony

dropd said:


> Good job Pony. Eclipse is definitely a nice ide for beginners and experts alike.
> 
> I would also recommend creating a second "Run..." configuration where instead of using the "Factory" class as your main executable, you use the "Simulator" class. (Keep the arguments string the same). That way, you can test your app in the simulator with one click, instead of having to start the factory and then launch the simulator from outside eclipse.


Good idea, that's slick. 

You also have to add both hme.jar and simulator.jar when you're setting up your project.

I'll add it in as an option above. Thanks for the suggestion!

Pony


----------



## TiVoPony

martinp13 said:


> Thanks Pony... always nice to have a lantern to help guide you through the swamp!  Can't wait to get home and give this a try.


You're welcome. 

Drop a post here when you get Hello World running.

Pony


----------



## trojanrabbit

Thanks, Pony.

Been a bad day for installing things, tried to install a printer on my old fileserver PC, the program ran once, said there wasn't enough disk space, and won't run again (there's plenty of space now), of course it's running WINME so I get what I deserve. Went to install all of the java stuff on this laptop and somehow I screwed up and deleted something I shouldn't have. That's what I get for using this laptop in bed.

Think everything is installed now and happy so I'll try what's in your post.


----------



## gman622

you also easily fool around with all the samples included in the SDK by choosing File>Import>Existing Ant Buildfile
(first change the pathelement of hme.jar) and browse to hme_sdk_ea1\samples\build.xml


----------



## fisherk

Cool I have been using Eclipse to build my Home Automation app but have been building then running every time. Now I run it right in the simulator from elcipse...
Very nice - thanx!


----------



## trojanrabbit

Ah, success! Hello World appears on the Kitchen TiVo

Time to try some of the other demos.

Now if only I could do this on the Humax DVD..... j/k


----------



## TiVoPony

trojanrabbit said:


> Ah, success! Hello World appears on the Kitchen TiVo
> 
> Time to try some of the other demos.
> 
> Now if only I could do this on the Humax DVD..... j/k


Congratulations! 

Feels good to get something running, doesn't it?

HME is coming to the DVD platforms, we started with the standalones. Remember, for now it's really a developers-only kind of feature, it's not intended yet for the average consumer. Later this year you'll see it more front and center, and on more boxes.

Cheers,
Pony


----------



## VaderFan

Thanks TivoPony for posting that walkthrough, certainly made things easy. Now I can put up provacative messages for my wife to check during commercials if I can keep her from pressing the skip button long enough.

PonyPoker is pretty sweet too! :up:


----------



## shady

Thanks for the tutorial Pony. This got me up and running really quickly. I'm now playing with and looking through the samples.

just need some inspiration now!!!


----------



## N.Tx.Beginner

gman622 said:


> you also easily fool around with all the samples included in the SDK by choosing File>Import>Existing Ant Buildfile
> (first change the pathelement of hme.jar) and browse to hme_sdk_ea1\samples\build.xml


Sorry if this should be obvious, but can you post and example showing how to change the pathelement of the hme.jar?


----------



## gman622

N.Tx.Beginner said:


> Sorry if this should be obvious, but can you post and example showing how to change the pathelement of the hme.jar?


this is what i changed my build.xml to include:

<property name="hme.jar" location="C:\TivoHME\hme_sdk_ea1\hme.jar"/>

<pathelement path="${hme.jar}"/>

of course you need to change "C:\TivoHME\hme_sdk_ea1\hme.jar" to wherever your hme.jar is located.

btw you can also add the bananas samples to the hme samples.
right click on TiVo HME Sample Applications:Import>File System, then browse to C:\TivoHME\bananas_ea1\sample\src Seclect All>Finish
then you add bananas.jar to your Java Build Path-Libraries(Add External Jars...)


----------



## jeffrey_ropp

TivoPony,

First, thanks for a nice writeup to get us java newbies moving. I've played around with a similar writeup that allowed me to write HelloWorld using another IDE, NetBeans. Would you say this environments are similar or does eclipse offer something uniquely well suited to HME dev?

More importantly, I'd love to see a sample project (or writeup - but preferably the former) that shows the way when using the bananas classes. I successfully got a project to run, but I'm not entirely sure how it worked nor could I walk someone thru it! Would you be up for another writeup with attachments?

Many thanks,
Jeff


----------



## boscodegama

Thanks for the getting started in Eclipse. I had recently started checking it out prior to HME being released but hadn't done anything serious in it yet. I'm definitely excited by the opportunities.

Anyway, I know enough about Java to be dangerous but don't know a lot of the methodology and practices. Anyone want to clue me in on how to create a Web Start JNLP from my project?



thanks..


----------



## jnk27

YeeHaa! It's alive. 

Thanks.
John


----------



## N.Tx.Beginner

Thanks, gman622.


----------



## rrr22777

Thank you TivoPony. I got HelloWorld to work. My motivation to do this was to change the default zip code in GoogleMap Plus!


----------



## quell

Thank You! Thank You! Thank You! 


Very usefull post. 

I was totally stuck trying to get this to run until I read your post.


----------



## DVDerek

Hello World Running! W00t! Netflix Queue, Here I come...


----------



## Judremy

OK, I'm trying to make my own Bananas app using BananasSampleScreen & TextScreen as templates. The problem is I put these both in com.judremy.hme similar to the example by TivoPony and try to get them to run, but the error I keep getting is:

error: no constructor: com.judremy.hme.ScreenBack.<init>()
error: make sure the class is public and has a public default constructor

ScreenBack is similar to BananasSampleScreen
HelloWorld is similar to BText

Any help is appreciated.


----------



## ZeoTiVo

martinp13 said:


> Brittney Spears* will be at TC-Con 2005 in Las Vegas! Check it out!
> 
> * Delicious asparagus appetizer available at the Montecito Hotel & Casino .


I am holding out for the Avril LaGreenBeans


----------



## ZeoTiVo

jeffrey_ropp said:


> TivoPony,
> 
> First, thanks for a nice writeup to get us java newbies moving. I've played around with a similar writeup that allowed me to write HelloWorld using another IDE, NetBeans. Would you say this environments are similar or does eclipse offer something uniquely well suited to HME dev?
> 
> Many thanks,
> Jeff


nothing uniquely suited to HME but eclipse is emerging as the standard platform upon which most other good IDES for Java are built. NetBeans may be from the source of Java but eclipse is much more universal and eclipse 3 is just the way to go.


----------



## dropd

ZeoTiVo said:


> nothing uniquely suited to HME but eclipse is emerging as the standard platform upon which most other good IDES for Java are built. NetBeans may be from the source of Java but eclipse is much more universal and eclipse 3 is just the way to go.


Um, I disagree wholeheartedly with this statement. It is both an oversimplification and factually incorrect.

Eclipse and NetBeans are probably the two most popular "free"/open-source IDE development platforms. Both focus on Java, though they also support (to varying degrees) other languages.

Both can also be used as application development frameworks themselves, not just as IDEs for building external applications. That is, you can build other apps out of the eclipse and netbeans code itself that aren't ide's.

Claiming that "eclipse is much more universal" doesn't make too much sense, because the IDE field is vast, with competing Java IDEs like JBuilder, IntelliJ IDEA, Oracle JDeveloper, etc. It is true that some other IDEs are built on Eclipse, like IBM's WebSphere IDE, but it's also true that others are built on top of NetBeans, like SunOne Application Studio. But eclipse as"the standard platform upon which most other good IDES for Java are built", I don't think so.

In the open source community, eclipse definitely has more momentum right now for lots of people, partially because for a few versions eclipse was a little bit faster-seeming, and because plugins are a little bit easier to develop for eclipse. NetBeans is far from dead, and is overall still a better IDE for doing web development (like with JSPs) out of the box.

Right now, I primarily use eclipse both at work and at home, but I recognize that there's no one IDE that's perfect for everyone. Nor should there be. Healthy competition on features and price move everyone forward.

"Eclipse 3 is just the way to go" isn't very informative.


----------



## TiVoPony

I knew there was a reason I didn't want to get into a NetBeans vs. Eclipse debate! 

Anyone developing an HME app on any IDE has my support. I'm using Eclipse because...that's what I started with. Pick one and run with it! Your customers will never know which you chose. 

Pony


----------



## hoopsbwc34

TiVoPony said:


> HME is coming to the DVD platforms, we started with the standalones. Remember, for now it's really a developers-only kind of feature, it's not intended yet for the average consumer. Later this year you'll see it more front and center, and on more boxes.


Well, I'll ask it (even though I can guess the answer) What are the chances of seeing this on DirecTivo?


----------



## ZeoTiVo

TiVoPony said:


> I knew there was a reason I didn't want to get into a NetBeans vs. Eclipse debate!
> 
> Anyone developing an HME app on any IDE has my support. I'm using Eclipse because...that's what I started with. Pick one and run with it! Your customers will never know which you chose.
> 
> Pony


I agree with this TiVoPony - my advice was more to people starting out in Java then those that have a tool set they use already. The power of Java is its versatility to be used in many different ways and not be constricted to only one supported approach. That is the very power of HME itself. I gave my simplified view and am done.

PS I had to laugh though when at the end of the post dropd siad he was using eclipse both at work and at home


----------



## dropd

ZeoTiVo said:


> PS I had to laugh though when at the end of the post dropd siad he was using eclipse both at work and at home


I'm not sure why you had to laugh at this. My point was simply that it's not productive for you to criticize the guy who was asking if it was ok to work in NetBeans, or to discourage folks from finding the toolset that works best *for them*. There is NO HME advantage to using eclipse. And eclipse is far from universal.

And with that, the horse is dead and buried.


----------



## ScottKuma

W00t!! Got my "Hello, World!" Program up & running.

Now I need to figure out something to write. I'm sure it'll come to me.


----------



## Robs67

I've never done any Java programming so please have mercy on me.
I followed Pony's instructions ( or so it would seem) but when I click on the "Run" button I get:
error: class not found: com.tivo.hme.HelloWorld
error: check the classpath and access permissions

Can anyone help me out?


----------



## ScottKuma

I had the same problem:

Make sure that you changed the "package ..." line at the top of the file to match what you typed in this step:



> Create a new package within that project. You can name it whatever you want...our guys use com.tivo.hme, you can use anything, just try to make it unique to you. All lower case. This creates a hierarchy of folders within your eclipse 'workspace' folder, matching whatever you type (eg. empty 'hme' folder inside a 'tivo' folder inside a 'com' folder.


I suspect that will solve your problem.

If not, make sure that you've created a run configuration, as in the following step:



> Now, select 'Run' from the menu bar, and scroll down the drop down window and select Run... Don't choose Run As!
> 
> A Run window will open. Click on Java Application (to the left), and then press the 'new' button. It'll create a new file labeled 'New_configuration'. Highlight it. This is the runtime configuration for this particular program. Change the Name: to something that makes sense (like HelloWorld). The Project name should be auto-filled. Below that is Main Class. Make sure that 'Include external jars when searching for main class' is checked on. Then type the word Factory into the dialog above that checkbox. Click 'Search', and you'll see a dialog of classes. Scroll down to the one labeled Factory and select it. The Main class dialog will then be auto-filled with the right path for the class (something like com.tivo.hme.Factory). All of that is on the 'Main' tab.


Hope that helped!!


----------



## Robs67

Thanks ScottKuma. I think I had a hierarchy issue. Eclipse gave a suggestion, which I followed and now it works.

Thanks again.


----------



## zomper514

I am trying to modify the Hello World sample included in the sample files. I want the program to say "Hello, Mark!" Instead. A simple change.

I modified the file and used the following compile line on My OSX Machine: 
_
javac -classpath /hme_sdk_ea1/hme.jar -sourcepath /hme_sdk_ea1/samples/src/com/tivo/hme/samples/ HelloWorld.java_

This created a HelloWorld.class file.

However I next ran the Simulator and the file was not modified?

_java -cp samples/samples.jar com.tivo.hme.sdk.Factory com.tivo.hme.samples.hello.HelloWorld_

I think the samples.jar file was never updated


----------



## F8ster

A quick note -- if you get an exception when you try to run this in the Simulator, make sure you have an active network interface on your machine. I was originally trying this on my laptop and getting an exception. Once I switched on my wireless access, the Simulator started working properly.

BTW, thanks, TiVoPony, for the helpful startup instructions -- this kind of thing is great.


----------



## F8ster

For those of you more visually oriented, I have recorded a screen video of this excellent introduction from TiVoPony (Flash required). Since I can't post links, you can find this demo on my website (click on my name to the left there to visit my homepage); find the link to 'TiVo App SDK - Cool!' in the left-hand nav, and it's linked off that page under 'Writing Your First Application.'

Note the little green progress bar and pause/play control at the bottom, if you need to pause it in the middle.


----------



## SafariKC

F8ster said:


> For those of you more visually oriented, I have recorded a screen video of this excellent introduction from TiVoPony (Flash required). Since I can't post links, you can find this demo on my website (click on my name to the left there to visit my homepage); find the link to 'TiVo App SDK - Cool!' in the left-hand nav, and it's linked off that page under 'Writing Your First Application.'
> 
> Note the little green progress bar and pause/play control at the bottom, if you need to pause it in the middle.


http://bitrazor.com/content/tivo/hme/tivo_hme_eclipse_demo1.html


----------



## TiVoPony

F8ster said:


> For those of you more visually oriented, I have recorded a screen video of this excellent introduction from TiVoPony (Flash required). Since I can't post links, you can find this demo on my website (click on my name to the left there to visit my homepage); find the link to 'TiVo App SDK - Cool!' in the left-hand nav, and it's linked off that page under 'Writing Your First Application.'
> 
> Note the little green progress bar and pause/play control at the bottom, if you need to pause it in the middle.


Nicely done! 

We've added it to the 'news' section of the sourceforge site:
TiVo HME SourceForge Site

Thanks for doing that. Very cool.

Pony


----------



## mgan42

Great tutorial. Thanks.

Now, I'd like to try using the HME SDK via IKVM on Mono. Have any Mono/C# fanatics tried this yet? My main reason is so that I can write my test application in C#, and use the Java HME SDK via import through IKVM. Since the HME simply runs on the PC, and not on the Tivo, I'm hoping this setup will work nicely. 

I would have provided HTML links to IKVM and Mono, but I'm prohibited, since this is my first post on this forum. Very annoying...

Anyway, any IKVM,Mono,C# folk out there?


----------



## F8ster

Well, this thread inspired me to begin writing my own app -- a "Traffic Cam Viewer" application. As I have progressed, I have documented everything in the form of a fairly extensive tutorial, one of those "learn it in an hour a day" kinds of tutorials.

In addition to the HME SDK. I also show how to get started with the Bananas UI toolkit. There's also a number of more intermediate Eclipse tips (using the debugger, etc.)

Since I can't yet post links, you can find this tutorial by clicking my username 'F8ster' over there on the left, selecting 'Visit F8ster's Homepage!', then choosing 'TiVo App Tutorial' from the left-hand nav bar on my homepage.

Comments and suggestions welcome. Enjoy -- Dave


----------



## F8ster

Here's the link for the new "Traffic Cam App" tutorial I mentioned in my last reply:

http://bitrazor.com/content/tivo/hme/traffic_cam_tutorial/index.php


----------



## F8ster

boscodegama said:


> Anyway, I know enough about Java to be dangerous but don't know a lot of the methodology and practices. Anyone want to clue me in on how to create a Web Start JNLP from my project?
> thanks..


Having just fought this battle myself, I documented the steps I used to create a JNLP deployment for my TiVo app and stuck them here. Not sure if I've got all of the best practices down pat yet, but this process worked for me:

http://bitrazor.com/content/tivo/hm...beyond_tutorial/howto/tivo_app_deployment.php

Other developer how-tos may be found here:

http://bitrazor.com/content/tivo/hme/traffic_cam_tutorial/beyond_tutorial/index.php

-- Dave


----------



## elrothir

I am attempting this tutorial and I think I'm just missing one minor thing, but can't seem to track it down. If someone could point me in the right direction, it'd be greatly appreciated. I set up the project in Eclipse and go to run it in the simulator, but when the simulator comes up, I get:

ERROR: File not found ://192.168.123.104:7288/hme

(The message parser thought I was trying to imbed a url, so that's why I did the ... slash-slash thing. The actual error message has "h" ttp in front of the ://). The xxx... IP address is the IP of my PC that I'm running on. I have a Linksys router and it has the firewall on, but since it's not going outside my subnet, I didn't think that'd matter. Though I'm pretty computer literate(am a programmer by trade), I'm not real strong on the firewall stuff. 

I just turned off the firewall and get the same error. My PC is running Galleon and works with no problems and the Tivo can see the music and pictures on my PC, so I'm really not sure why the simulator doesn't work. Also, not sure if it matters, but when I select Run and do a search for the Main Class, I do not see Factory in the list. I see Simulator and choose that one, but Factory is not on the list even though hme.jar was loaded...

Any suggestions? 

Thanks,
elrothir


----------



## TiVoPony

elrothir said:


> I am attempting this tutorial and I think I'm just missing one minor thing, but can't seem to track it down. If someone could point me in the right direction, it'd be greatly appreciated. I set up the project in Eclipse and go to run it in the simulator, but when the simulator comes up, I get:
> 
> ERROR: File not found ://192.168.123.104:7288/hme


Hi there,

The error you're seeing is due to a recent change in the hosting implementation. We don't use Factory anymore, instead you should type com.tivo.hme.host.sample.Main into the Main class dialog in Eclipse.

Also, when you add external libraries to your project, make sure to include the hme-host-sample.jar file as well.

I've updated the tutorial, sorry about the confusion!

Cheers,
Pony


----------



## leep

I have multiple Network Interfaces. When I run the HelloWorld sample from this thread it binds to the wrong IP. I've tried adding the -i <correct ip> to the Program arguments like it shows in the SDK samples, but that doesn't work. How can I tell it to bind to the correct IP?


----------



## F8ster

I believe that with HME v1.3 and above, the option changed from "-i" to "--intf".


----------



## F8ster

I have updated the Flash demo of this tutorial for HME v1.3 and 1.4:

*http://bitrazor.com/content/tivo/hme/tivo_hme_eclipse_demo1.php*


----------



## RedMan8

I was able to follow the Flash Tutorial (thanks F8ster!)... but I'm now trying to compile my new "Hello World" application into a .jar file.

I have a manifest file, but whenever I double-click on the jar it tells me it can't find the main class. I have tried a whole bunch of settings in my manifest file but none of them seem to work.

Any ideas what I could be doing wrong?


----------



## RedMan8

Just to give a little more detail... this is all I currently have in my manifest file:

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

The error message I'm getting when I double-click the jar file is:
Could not find the main class. Program will exit.


----------



## F8ster

OK, here's what you have to do. (You'll probably be sorry you asked.  )

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/

Simple, huh?


----------



## RedMan8

I knew it would be messy, but that's just what I was looking for!
I'll give it a try when I get home, but it sounds perfect.

Thanks (again) F8ster!

--Edit--

It works it works!!
I added a little .bat file with the java command so I can just double-click to run it now.

WOO HOO!

--End of Edit--


----------



## trovan

Thanks for the info. HelloWorld is working here.

Trovan


----------



## jackreacher

Got HelloWorld here as well. Thanks very much for the flash example.

I would like to emphasize someone else's tip concerning users on vpn, etc. My first attempt didn't bind to my ip so added the following in the arguments window:


Code:


com.tivo.hme.HelloWorld
--intf 192.168.1.8

...with the ip of the machine running the java app. Worked fine then.


----------



## kpm3102

Thanks for this tutorial...it's been a HUGE help. I am wondering how to make the Hello World app run using Java Web Start?


----------



## mondelicious

Hello, all.

First things first. Tremendous thanks to F8ster. I found your tutorials on bitrazor before coming here, and they were invaluable in getting me started with hme development.

I have had some measure of success in getting my app running, even though this is my first java project.

I have so far been able to run my app in the simulator and using the com.tivo.hme.host.sample.Main class from the Run menu within Eclipse. I am having trouble figuring out how to export a jar that will run standalone.

I am developing on a mac, running OS X 10.4.6, using Eclipse 3.1.1.

I am hoping to export either a double-clickable jar or an application bundle.

Thanks,
mondelicious


----------



## F8ster

mondelicious said:


> Hello, all.
> 
> First things first. Tremendous thanks to F8ster. I found your tutorials on bitrazor before coming here, and they were invaluable in getting me started with hme development.
> 
> I have had some measure of success in getting my app running, even though this is my first java project.
> 
> I have so far been able to run my app in the simulator and using the com.tivo.hme.host.sample.Main class from the Run menu within Eclipse. I am having trouble figuring out how to export a jar that will run standalone.
> 
> I am developing on a mac, running OS X 10.4.6, using Eclipse 3.1.1.
> 
> I am hoping to export either a double-clickable jar or an application bundle.
> 
> Thanks,
> mondelicious


Thanks for the kind words. Makes it worth the effort...

It is possible to do what you're attempting, although it's painful. Here are the basic steps:


Extract everything from each JAR in your app into a directory. Use 'jar xvf hme.jar', for example, to extract everything from hme.jar into an expanded directory. Repeat for each JAR in your application.
Create a new manifest with Main-class: set to the class containing your main. Call it 'mymanifest'. See a few responses up (this one) in this thread for a syntax example. Put it in the same dir. you're expanding all of this stuff into.
Use 'jar cvfm my_big_jar.jar dir/mymanifest dir/*' to wrap it all up into a new JAR.
You can then do 'java -jar my_big_jar.jar' to run it, or double-click the JAR.

I'll try to test this with HelloWorld just to make sure I'm not giving you bad info here, but this should get you pointed in the right direction. Here's some links from Sun to help:

http://java.sun.com/docs/books/tutorial/deployment/jar/basicsindex.html
http://java.sun.com/docs/books/tutorial/deployment/jar/build.html
http://java.sun.com/docs/books/tutorial/deployment/jar/index.html

There's gotta be some software package that'll automate this for you, but I've yet to run across one. Once you get it working, it should be fairly scriptable, though.


----------



## mondelicious

eep!

Thanks for the info. I was really hoping it would be a matter of choosing the right options in the Eclipse export wizard. Ah well....

I guess I'll have to study a bit.

Thanks.
mondelicious


----------



## mondelicious

I've made a bit of progress.

I extracted the hme and sample hosting jars, as well as my own app. Then, I used a manifest file pointing to com.tivo.hme.host.sample.Main as an entry point and followed your directions for creating a big jar.

This seems to have gotten me to the point where a Main class is actually found, but I am missing the argument for the main class.

null null (null)
com.tivo.hme.interfaces.IArgumentList$BadArgumentException: missing argument
at com.tivo.hme.host.util.ArgumentList.shift(ArgumentList.java:130)
at com.tivo.hme.host.sample.Main.createFactory(Main.java:382)
at com.tivo.hme.host.sample.Main.<init>(Main.java:151)
at com.tivo.hme.host.sample.Main.<init>(Main.java:60)
at com.tivo.hme.host.sample.Main.main(Main.java:534)
error: missing argument
usage: Main [options] class

Options:
--port <port> listen on a specific port
--intf <interface> listen on a specific interface
--nomdns <interface> listen on a specific interface, without mdns
--launcher <file> start factories listed in file
--jars scan directory for HME app jar files
--jar <jarfile> start factory for the given jar

I can't figure out where to put this argument, which I'm assuming will be the jar name.

Am I on the right track?

mondelicious


----------



## F8ster

Yep, this is what I found as well. The argument appears to be accepted only on the command line, e.g.

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

This is one of the reasons I use exe4j to wrap my Java apps in a Windows .exe (doesn't do you any good on a Mac, I know). You might also look at Java Web Start, and the Duck Creek JNLP wrapper for it.

FWIW, here's the script I include with the NetFlix RSS Reader to run my app. Notice that I don't even fight with trying to combine the jars; I just stick them all in a 'jars' directory (although I suppose 'lib' would be more conventional) and the script adds them one by one. Some kind soul contributed this script:



Code:


#!/bin/bash

for jar in $(ls -1 jars); do
if [ -z $classpath ]; then
classpath="jars/$jar"
else
classpath="$classpath:jars/$jar"
fi
done

echo $classpath

java -cp $classpath com.tivo.hme.host.sample.Main com.bitrazor.netflixrss.NetFlixRSS


----------



## mbalgeman

Since I've just started working with Eclipse for work projects, I've noticed that there seems to be a plugin for everything. So when I ran across this thread and read the new replies I thought, "I bet there's a plugin for that!!!". Sure enough...

http://fjep.sourceforge.net/

I make no claims that it does everything you want or actually works, but it might be worth a look.


----------



## mondelicious

Thanks for the info.

I successfully used the wizard from Duck Creek to create a jnlp, but only with the demo license. I am waiting for a proper license so that I can test launch (right now, it starts launching but exits with an expired license message). This seems like a great way to deploy. I am allowed to set a Main class and arguments. The result will be a double-clickable file.

I'll post an update when I have some success.
mondelicious


----------



## Jabneel

TiVoPony said:


> Pick one and run with it! Your customers will never know which you chose.
> 
> Pony


Customers? Is anyone here developing apps for the Tivo Box for a business (or side business)?

Just curious.


----------



## andrew_henk

Thank's was very helpfull


----------



## gbalcombe

I use Eclipse quite a bit, and never knew there was a way to build Tivo Apps. Can't wait to get started.

I am also a Technical instructor so will try to document my experiences so that others can follow my steps.


----------



## rvaniwaa

Given that I have used these instructions to write an application that I think others may like, how do I then package it up in a jar file so others can use it? I am a relative Java neophyte but take direction fairly well!

--Ron


----------



## F8ster

See

http://bitrazor.com/content/tivo/hme/howtos/create_jar.php

Other HME Developer How-Tos may be found here:

http://bitrazor.com/content/tivo/hme/howtos/index.php


----------



## rvaniwaa

Tried those instructions using the manual method without much success:



Code:


macbox:~/Documents/workspace/My HME Projects rvaniwaa$ cat mymanifest 
Manifest-Version: 1.0
Class-Path: hme-host-sample.jar hme.jar
Main-Class: com.tivo.hme.host.sample.Main

results:



Code:


macbox:~/Documents/workspace/My HME Projects rvaniwaa$ jar -cvfm ../../bejeweled.jar mymanifest com/tivo/hme/*class
added manifest
adding: com/tivo/hme/BeJeweled.class(in = 1674) (out= 972)(deflated 41%)
adding: com/tivo/hme/Board$Jewel.class(in = 1940) (out= 1027)(deflated 47%)
adding: com/tivo/hme/Board$coordinate.class(in = 462) (out= 321)(deflated 30%)
adding: com/tivo/hme/Board.class(in = 9200) (out= 4638)(deflated 49%)
adding: com/tivo/hme/HelloWorld.class(in = 894) (out= 514)(deflated 42%)
macbox:~/Documents/workspace/My HME Projects rvaniwaa$ java -jar ../../bejeweled.jar 
Exception in thread "main" java.lang.NoClassDefFoundError: com/tivo/hme/host/sample/Main
macbox:~/Documents/workspace/My HME Projects rvaniwaa$

Current directory contents:


Code:


macbox:~/Documents/workspace/My HME Projects rvaniwaa$ ls
com                     hme.jar
hme-host-sample.jar     mymanifest

I also want to add images and sound. Whenever I get this working, do I just add those to the jar file as well?

--Ron


----------



## F8ster

Copy the bejeweled.jar file into the same directory as hme.jar and hme-host-sample.jar and do:



Code:


java -cp hme.jar;hme-host-sample.jar;bejeweled.jar com.tivo.hme.host.sample.Main [COLOR=Red]com.tivo.hme.Bejeweled[/COLOR]

Replace the text in red with the correct name for your application if it's not correct. This is simply the package name plus the class name of the class that contains your init() routine. And yes, you can add images directly into the JAR if you like.


----------



## miller890

Like the traffic cam app, I was wondering if it is possible to display four URL images at once. Galleon will display and refresh one image with a boarder and continuously refresh it (when you press play), but that is not exactly what I am looking for. I would like to display and refresh 4 images (2x2) without a boarder. I have gone through the traffic cam tutorial which I was able to get working and could kind of understand what it was doing - I am not having any luck resizing and add images. I just dont know if it is possible to display four images at once; on top of that if I could add user/password function so I dont have to leave them wide open would be a bonus. Any pointers would be appreciated.


----------



## saberman

TiVoPony said:


> Want to write an HME app? Maybe you've dabbled in code before, but never Java. It's not hard, but getting the tools to work is always the first hurdle.
> 
> Want to get started? Here's one way, and it won't cost a penny. Note that I won't go into all the why's, but rather focus on the how's...let's get you up and running.
> 
> <<<clip>>>
> 
> Last edited by TiVoPony : 10-25-2005 at 12:40 AM.


Is this still valid or is there an updated version around?


----------



## jbcooley

To the best of my knowledge, this is still valid for java. There are other options available now.
Hme for Python
Hme SDK for .NET


----------



## F8ster

The Flash demo's up to date:

http://bitrazor.com/content/tivo/hme/tivo_hme_eclipse_demo1.php


----------



## saberman

jbcooley said:


> To the best of my knowledge, this is still valid for java. There are other options available now.
> Hme for Python
> Hme SDK for .NET


Are these the current versions:

For the Java SDK 1.42 from java.sun.com
Windows Platform - Java(TM) SE Development Kit 6
jdk-6-windows-i586.exe

For the HME SDK from tivohme.sourceforge.net
hme_sdk_1.4.0.zip

For the Eclipse IDE from www.eclipse.org
Eclipse IDE for Java Developers
eclipse-java-europa-fall2-win32.zip


----------



## alu2963

I have problems to add external libraries, the eclipse say me that everthing is OK, but once this the simulator doenst link these libraries,some idea why so?


----------



## johnbe2

Can anybody tell me what kind of data is available to the SDK from the TiVo DVR itself? I.e. is it possible to extract info like TiVo account #, device serial # or recently watched item perhaps? Any pointers or info would be appreciated.


----------



## johnbe2

johnbe2 said:


> Can anybody tell me what kind of data is available to the SDK from the TiVo DVR itself? I.e. is it possible to extract info like TiVo account #, device serial # or recently watched item perhaps? Any pointers or info would be appreciated.


anyone?


----------

