1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Getting Started with Eclipse

Discussion in 'Developers Corner' started by TiVoPony, Feb 15, 2005.

  1. F8ster

    F8ster The Very Last One

    232
    0
    May 26, 2002
  2. F8ster

    F8ster The Very Last One

    232
    0
    May 26, 2002
    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
     
  3. elrothir

    elrothir New Member

    21
    0
    Dec 12, 2004
    KS
    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
     
  4. TiVoPony

    TiVoPony New Member

    2,194
    0
    May 11, 2002
    Alviso,...
    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
     
  5. leep

    leep New Member

    1
    0
    Oct 17, 2005
    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?
     
  6. F8ster

    F8ster The Very Last One

    232
    0
    May 26, 2002
    I believe that with HME v1.3 and above, the option changed from "-i" to "--intf".
     
  7. F8ster

    F8ster The Very Last One

    232
    0
    May 26, 2002
  8. RedMan8

    RedMan8 Member

    195
    0
    Sep 30, 2005
    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?
     
  9. RedMan8

    RedMan8 Member

    195
    0
    Sep 30, 2005
    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.
     
  10. F8ster

    F8ster The Very Last One

    232
    0
    May 26, 2002
    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? :)
     
  11. RedMan8

    RedMan8 Member

    195
    0
    Sep 30, 2005
    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--
     
  12. trovan

    trovan New Member

    6
    0
    Mar 27, 2004
    Thanks for the info. HelloWorld is working here.

    Trovan
     
  13. jackreacher

    jackreacher New Member

    1
    0
    Feb 28, 2006
    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. :)
     
  14. kpm3102

    kpm3102 New Member

    1
    0
    Mar 29, 2006
    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?
     
  15. mondelicious

    mondelicious New Member

    29
    0
    Jul 26, 2005
    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
     
  16. F8ster

    F8ster The Very Last One

    232
    0
    May 26, 2002
    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.
     
  17. mondelicious

    mondelicious New Member

    29
    0
    Jul 26, 2005
    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
     
  18. mondelicious

    mondelicious New Member

    29
    0
    Jul 26, 2005
    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 <dir> 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
     
  19. F8ster

    F8ster The Very Last One

    232
    0
    May 26, 2002
    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
     
  20. mbalgeman

    mbalgeman Bagel Man

    540
    0
    Feb 6, 2002
    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.
     

Share This Page