12 Replies Latest reply on Oct 17, 2008 10:34 PM by 843851

    Developing Xlets using Java 1.5

      Hi Folks,
      Does anybody knows that is it possible to develop Xlets using Java 1.5. I tried to write some using NetBeans 5.0, and jdk 1.4. ?
        • 1. Re: Developing Xlets using Java 1.5
          I'm not sure if my experience helps but at least it provides a reference.
          My environment is a linux x86 PC (linux 2.6) + eclipse 3.2 + j2se 1.4.2_09
          I downloaded javatv 1.0 / 1.1 source codes of reference implementation from sun.

          You can create a project in eclipse where imports all source codes.
          Please fix all possible errors (if any). Usually if there are some, just comment them.

          Finally, please export the project as a jar file.

          You can then create another project and configure the build path, click "import external jars" to import the generated javatv jar.
          Now you can create your own xlet by creating a java file which implements javax.tv.Xlet.xlet interface in the same project.

          To execute the xlet, you need to implement main method and create
          an instance of SIEmulator (assume myemulator). And then you can call
          myemulator.putResidentXlet() and fill name / path of the xlet in.
          Finally please go to the output folder (which contains the compiled class file of the source codes, usually folder "bin"), type
          "java -Djava.class.path="path of the javatv jar" class_containing_main_method

          Note that the xlet executed is NOT in a service context. If you wish to run in a service context, you either need to modify codes in com.sun.tv.XletManager.java to fill a service context object for the xlet or put the xlet's info in javatv's SI source, an xml file. Default is "JavaTVSampleFile01.xml". The usage please refer to javatv's documents.

          If there is any error, please kindly correct it for me, thanks.
          I hope that the text above helps a little bit.
          • 2. Re: Developing Xlets using Java 1.5
            1.5 ? no.
            Maybe in simulation you could manage to run it but surely not on an MHP STP. The requirement for an MHP application running on target is java 1.1.8 so pretty old.
            • 3. Re: Developing Xlets using Java 1.5
              Mr W,
              which emaul´┐Żator do you use to run the xlets and if you do not mind could you send me an example to mdantasATpobox.com
              • 4. Re: Developing Xlets using Java 1.5
                Generally you can use whatever you want to develop java code.
                For example I use eclipse 3.1 and sun jdk 1.5.
                To be mhp1.0.3 compliant I use a mhp stub stak (taken from www.mhp-knowledgebase.org) and I set source to 1.3 and target to 1.1 as javac attributes
                • 5. Re: Developing Xlets using Java 1.5
                  actually I didn't know you mean to develop MHP applications.
                  JavaTV was defined and developed prior to MHP, parts of JavaTV APIs
                  are "borrowed" by MHP, the Xlet API is one of them.

                  The approach I described above is for running a resident xlet only
                  with JavaTV class library, it is NOT an MHP compliant environment,
                  and the xlet's implementation also has no MHP API to import.

                  To implement an MHP compliant xlet, you can download and import MHP stub class library as MarcoFra describes.

                  For an MHP emulator, you can try xletview or openMHP, but they are not MHP compliant yet. For a full MHP emulator, you can try IRT MHP RI, which is a product of IRT.
                  • 6. Re: Developing Xlets using Java 1.5
                    Tks Mr. W for the help !
                    I forgot to explain what is really happening.
                    I am compiling my xlet sources under Netbeans 5.0 without problem. When I try to run the class generated code with xletview and I make use (in my code) of java 1.5 features, xletview crashes...
                    I want to use some web service stuff with xlets, but it seems that will be impossible to use right now due to the java version compatibility

                    Message was edited by:
                    • 7. Sample Xlets
                      I created a emulator setup to run xlets.
                      Kindly let me know the links from which i get sample Xlets
                      • 8. Re: Sample Xlets
                        you can check some stuff @ http://www.interactivetvweb.org/resources/code/index.shtml
                        Cheers !
                        • 9. Re: Developing Xlets using Java 1.5
                          I'm using Netbeans 5.5 and las jdk and there are no problems. What you must do to avoid crashing the xlet and other errors is this: Go to the properties of the project and in the "Sources" tab choose Source level -> 1.3. In the Compiler options (under Build -> compiling, also in the project properties) add "-target 1.1"

                          With this configuration you will be warned when use something that cannot be used creating xlets.
                          • 10. Developing Xlets
                            Hi Folks,
                            Tell me how to create a UI screen using a Xlets.
                            • 11. Re: Sample Xlets
                              This website gives some sample codes which can be compiled and can able to run only 3 codes out of many but all.
                              • 12. Re: Developing Xlets using Java 1.5
                                With the current download from reference implementation from


                                I found I had to make a few changes to get anything to work well. First, I found that there is some kind of XML parsing error (not due to a file being bad but something else):

                                java -cp samples\runxlet;javatv.jar RunXlet SvcDispXlet

                                and it brings up a window but nothing is rendered. The output I see is

                                Running Xlet named: SvcDispXlet
                                ServiceFile: com.sun.tv.receiver.ReceiverFile
                                JMFProperties: readProperties
                                Running Data from Class = com.sun.tv.receiver.ReceiverFile
                                Parsing failed: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequence
                                Exception: Invalid byte 1 of 1-byte UTF-8 sequence., file: lib\JavaTVSampleFile01.xml
                                XletContainer constructor
                                ROOTFRAME: OTHER 0:com.sun.tv.XletContainer[,0,0,0x0,invalid,hidden]

                                so I had to change


                                # ServiceFileHandler=SampleData_01


                                # ServiceFileHandler=com.sun.tv.receiver.ReceiverFile

                                If you want a ServiceContext, try downloading the source and changing


                                private static ServiceContext svcctx = null;

                                if(svcctx == null){
                                try { svcctx = new com.sun.tv.ServiceContextImpl(); }catch (Exception e){ e.printStackTrace(); }
                                AppSignalEvent ase = new AppSignalEvent(dispManager.getRootFrame(),
                                AppSignalEvent.AUTOSTART, null, xletPath, xletName, svcctx, args);^M

                                but this still will not give you events. Some Xlet's (like the BdjGunBunny Xlet) wait for suchs events before starting.


                                See code in

                                void waitForPresenting()

                                * Get a system callback via ServiceContextListener
                                public void receiveServiceContextEvent(ServiceContextEvent e) {
                                if (e instanceof NormalContentEvent) {
                                synchronized(this) {
                                isPresenting = true;