Xletview: why not use sun's javaTV source code directly ?

xletview : one emulator for viewing MHP Xlets on a PC;
I see many difference from sun's code about the part of javaTV.
Why the author Martin Sveden need to rewrite them and not use sun's javaTV source code directly ?
Thank you for your any answer.
Sorry for my horrible english.

XleView is a fine effort, but it has its limitations. I tried using it for the GunBunny demo available in the JavaME SDK 3.0 Eary Access available in
http://java.sun.com/javame/downloads/sdk30ea.jsp
and I encountered some of thost limitations. What Sveden does it several tricky manipulations in a classloader for the Xlet. In particular, he translates bytecode as he loads the Xlet's classes, changing some class names, such as changing
java.awt.Toolkit
tto
xjava.awt.Toolkit
This works up to a point. This version of Toolkit usually just turns around calls java.awt.Toolkit's corresponding routine, but he deliberately he does not implement the ubiquitous
public Image createImage(URL url)
When I downloaded his source and tried adding ths into his code, I then encountered at runtime
Uncaught error fetching image:
java.lang.NullPointerException
at sun.awt.image.URLImageSource.getConnection(URLImageSource.java:97)
at sun.awt.image.URLImageSource.getDecoder(URLImageSource.java:107)
at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:240)
at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:172)
at sun.awt.image.ImageFetcher.run(ImageFetcher.java:136)
I think that this is some optimization within J2SE where they do not wait for the image to load and do the fetching in a separate thread. I do not know if there is some way to force the Sun's JVM to disable this optimization and I have not investigated furher, but I did email Svenden. I noticed that the current version of XleTView is 0.3.6 which is dated June 2004 and the web site http://www.xletview.org/ has had not news since 2005 .
I note that Svenden provides an elegant user interface but I advise you not try to learn the API's from his classes: he makes no effort to keep his implementation separate from the API standards so, for instance, his version of HScene is
package org.havi.ui;
public class HScene extends Container
implements HComponentOrdering, ImageObserver, MenuContainer, Serializable {
whereas the real standard is
public class HScene extends Container
implements HComponentOrdering {
I hate to critize such a fine effort, but it is best to keep an imlementation separate from the public API.
I agree that having a lightweight, simple and Java feature-complete Xlet viewer running would be very helpful, especially if BD-J gains much popularity. I have found trying to work with the vendor players described at
http://wiki.java.net/bin/view/Mobileandembedded/Blu-RayDiscHelloWorld
to be frustrating. I tried all four mentioned and I have gotten none of them to work for me yet. These are huge downloads and the "Intro Version" of Arcsoft pointed to at the SDK 3.0 Early Access page
http://www.arcsoft.com/products/totalmediatheatre/
just gives a "File not found" HTML page. This forum post mentions that perhaps it was recently taken down?
http://www.arcsoft.com/forum/forum_posts.asp?TID=1084
I have already emailed Michael Downs of Arcsoft since he is mentioned here:
http://wiki.java.net/bin/view/Mobileandembedded/BDJPCPlayers
What did work for me was to take Sun's JavaTV 1.1 Reference Implementation and PowerDVD's BDJ.jar and hack/fix a few classes to get GunBunny to work within the RI's RunXlet program. This is not trivial but I will will describe:
Download the JavaME 3.0 SDK EA and then download the correct version of PowerDVD that the SDK page points to:
http://www.brothersoft.com/powerdvd-download-50794.html
Download the RI binary and source of Java TV API 1.1
http://java.sun.com/javame/technology/javatv/index.jsp
Since I am too lazy to use anything but the latest 1.6 JRE as a runtime, I have to fix
com.sun.tv.media.util.MediaThread
to comment out its stop() method. This is becase stop() was deprecated and made final in J2SE 1.5
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Thread.html#stop()
http://java.sun.com/j2se/1.5.0/docs/guide/misc/threadPrimitiveDeprecation.html
Next, I had to mae a change to Sun's JavaTV implementation to keep the GunBunny demo happy by providing a ServiceContext. The RunXlet program calls SIEmulator, but that environment does not provide a ServiceContex, so I added one back in:
com.sun.tv.receiver.SIEmulator
private static ServiceContext svcctx = null;
Add before every call to new AppSignalEvent() and add the svcctx as the second-to-last argument:
if(svcctx == null){ try { svcctx = new com.sun.tv.ServiceContextImpl(); }catch (Exception e){ e.printStackTrace(); } }
I then had to hack a few PowerDVD classes, which is evil of me. First, I had to build an empty class by the name of
sun.util.BDJPlugin
becuase some PowerDVD class extends it but it is not in its BDJ.jar and then I had to reverse-compile (evil!) and modify one of their internal classes to avoid a dependency on their native methods. What I ended up with was a hacked version of com.cl.bdj.helper.CUtil to avoid the native methods which access the registry where they query for registry settings but also provide a default value (which I return).
com.cl.bdj.helper.CUtil
private static String pGetRegistryString(long i ,String string ,String string3) {
return string3;
private static int pGetRegistryInt(long i ,String string ,int j) {
return j;
The last thing I had to do was to change com.hdccookbook.gunbunny.BaseXlet, to use the JavaTV container rather than the org.havi one:
import javax.tv.graphics.TVContainer;
import java.awt.Container;
change
// protected HScene scene;
protected Container scene;
public final void run() {
// waitForPresenting();
// scene = HSceneFactory.getInstance().getDefaultHScene();
scene = TVContainer.getRootContainer(xletContext);
In order to having working keys, I had to add the KeyListener interface to BaseXet and
run(){
addKeyListener(this);
and then add a near duplicate of the org.dvb.event.UserEvent* stuff that is already there:
public void keyPressed(KeyEvent e){
switch(e.getKeyCode()){
case KeyEvent.VK_0:
case KeyEvent.VK_1:
case KeyEvent.VK_2:
case KeyEvent.VK_3:
case KeyEvent.VK_4:
case KeyEvent.VK_5:
case KeyEvent.VK_6:
case KeyEvent.VK_7:
case KeyEvent.VK_8:
case KeyEvent.VK_9:
numberKeyPressed(e.getKeyCode() - KeyEvent.VK_0);
break;
case KeyEvent.VK_ENTER:
enterKeyPressed();
break;
case KeyEvent.VK_LEFT:
arrowLeftKeyPressed();
break;
case KeyEvent.VK_RIGHT:
arrowRightPressed();
break;
case KeyEvent.VK_UP:
arrowUpPressed();
break;
case KeyEvent.VK_DOWN:
arrowDownPressed();
break;
public void keyReleased(KeyEvent e){
// System.out.println("Released: e="+e+" code="+e.getKeyCode());
public void keyTyped(KeyEvent e) {
// System.out.println("Typed: e="+e+" code="+e.getKeyCode());
It then comes up and functions, but the rendering is not very good. Again, this is complete hack. Running the Java TV 1.1 RI in a JRE 1.6 is not supported. If you try to run any of the other examples, you will discover that the XML parsing is broken in JRE 1.6 with this message:
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
and you have to go and change the lines in
lib\JavaTV.properties
from
ServiceFileHandler=com.sun.tv.receiver.ReceiverFile
# ServiceFileHandler=SampleData_01
to
# ServiceFileHandler=com.sun.tv.receiver.ReceiverFile
ServiceFileHandler=SampleData_01
and build samples\db\SampleData_01.java and put it in your classpath along with all these other hacks.
Nonetheless, if you want to develop a somewhat generic Xlet that uses some BD-J features, that is how you might do it. But the moment you exercise anything else in the vendor's BDJ.jar that simply doe snot work outside of their environment or invokes one of their native methods, you are again stuck.
It would be nice if Sun would at least bother to update the JavaTV RI with the fixes I hae mentioned. Their "jmflite" implementation does not render perfecly but at least it would give the programmer something to work with without having to deal with an older JRE, etc.
Andrew
Edited by: AndrewMorrow on Oct 20, 2008 2:48 AM

Similar Messages

  • Why not use notifyall

    now I'm reading this book "Java Threads 2nd edition" by Scott Oaks and Henry Wong. Writer provide a class called BusyFlag to simulate the mutex.
    I wonder why not use notifyall() to replay notify().
    public class BusyFlag {
         protected Thread busyflag = null;
         protected int busycount = 0;
         public synchronized void getBusyFlag() {
              while (tryGetBusyFlag() == false) {
                   try {
                        wait();
                   } catch (Exception e) {
         public synchronized boolean tryGetBusyFlag() {
              if (busyflag == null) {
                   busyflag = Thread.currentThread();
                   busycount = 1;
                   return true;
              if (busyflag == Thread.currentThread()) {
                   busycount++;
                   return true;
              return false;
         public synchronized void freeBusyFlag() {
              if (getBusyFlagOwner() == Thread.currentThread()) {
                   busycount--;
                   if (busycount == 0) {
                        busyflag = null;
                        *notify();*
         public synchronized Thread getBusyFlagOwner() {
              return busyflag;
    }

    naficbm wrote:
    now I'm reading this book "Java Threads 2nd edition" by Scott Oaks and Henry Wong. Writer provide a class called BusyFlag to simulate the mutex.
    I wonder why not use notifyall() to replay notify().Looks like it should work with notifyall as well.

  • Why not use "new" operator  with strings

    why we not use new when declaring a String .because in java String are treated as objects. we use new operator for creating an object in java .
    and same problem wiht array when we declare array as well as initialize .here we are alse not using new for array
    why

    Strings aren't just treated as objects, Strings are Objects.
    As for why not using new for Strings, you can, if you want.:
    String str = "this is a string";
    and
    String str = new String("this is a string");
    do the same thing (nitty-gritty low level details about literals aside). Use whatever you like, but isn't it simpler not to type new String(...) since you still need to type the actual string?
    As for arrays, you can use new:
    int[] ints = new int[10];
    or
    int[] ints = { 0, 1, 2, 3, ..., 9 };
    But the difference here is you are creating an empty array in the first one, the second creates and fills the array with the specified values. But which to you often depends on what you are doing.

  • Why not use paper label on finished DVD project?

    I also use printed paper labels for my DVD covers
    why not use them?
    please advise?

    Hi
    The DVD get's unbalanced = Laser can't read track
    DVD are several times more sencitive than CD (not advicable to put lables on them either)
    And DVDs/CDs that are unbalanced also give more strain to the player mechanism
    that eventually stops working.
    Yours Bengt W

  • Why not use interfaces for constants?

    Hi,
    I have been getting conflicting views about why not use interfaces for constants?
    Can anyone shed some light on it?
    Piyush

    How so?
    If the constants are only used in a single classhow
    does it help to put them in a separate structute?
    (Ignoring the a type safe enumeration of course.)Well, mainly for readability. Suppose that you have a
    web application which has a servlet class
    "RedirectServlet", which takes a variable to redirect
    to a given JSP file. In the JSP files, you want to
    create forms which take this servlet as their action.
    You could of course put all these "redirect"
    constants in the RedirectServlet itself, but then
    it's kind of weird that you have to import a
    servlet in your jsp file to include these constants
    and to be able to write
    <form action="servlet/RedirectServlet?key=<%=
    RedirectServlet.HOMEPAGE %>> or so.
    Instead, you could create an interface called
    "RedirectConstants", and then your servlet
    RedirectServlet could implement this interface. Then
    your JSP can also access these constants via this
    interface.
    But then again, this is merely a matter of style, I
    fully agree that there is never a real _need_ to put
    constants in a separate structure if they're only used
    in a single class.Are you claiming that your example above is a single class?

  • Using wysiwyg text editor in drupal the latest firefox does not wrap text when viewing source code-chrome ie ok

    Using drupal ckeditor profile with wysiwyg . Firefox latest version is apparently not respecting the width of the i-frame text editor box and the text is not wrapping when viewing in source code mode. Chrome and IE are working as expected. Windows 7

    [https://support.mozilla.org/en-US/kb/where-go-developer-support Where to go for developer support]

  • Since I upgraded to iOS 7.1.2, new Outlook calendar and contact items will not sync to/from my iOS devices - I am not using the iCloud, just sync'ing direct to/from laptop. Does anyone have a solution?

    Since I upgraded to iOS 7.1.2, new Outlook calendar and contact items will not sync to/from my iOS devices - I am not using the iCloud, just sync'ing direct to/from laptop. Neither direction seems to be working.
    Does anyone have a solution?

    Hello Happy-in-the-Mountains,
    Thanks for using Apple Support Communities.
    To troubleshoot this issue where you're unable to sync between your iPhone and Outlook, I'd like you to please follow the steps in the article linked to below.
    Troubleshooting Sync Services on Windows with Microsoft Outlook 2003, Outlook 2007, or Outlook 2010 - Apple Support
    Have a great weekend,
    Alex H.

  • Why frameset?  Why not use a table?

    Why do we need to use the framesets?
    I think that we should use the tables because the framesets
    do not show you the border sizes and background colors on the
    source (code window). The tables show you everything including the
    background color codes so that you would know where to find it on
    the source window. Although, a frameset is a big risk.
    If you think that I'm wrong, then can you please explain it
    to me. I respect your opinion.

    "jeffeyer" <[email protected]> wrote in message
    news:ectmha$shq$[email protected]..
    > Why do we need to use the framesets?
    >
    > I think that we should use the tables because the
    framesets do not show
    you
    > the border sizes and background colors on the source
    (code window). The
    tables
    > show you everything including the background color codes
    so that you would
    know
    > where to find it on the source window. Although, a
    frameset is a big
    risk.
    >
    > If you think that I'm wrong, then can you please explain
    it to me. I
    respect
    > your opinion.
    >
    You are right. Tables and/or css are preferable to a frames
    layout.
    Though I can understand why somebody would want to use
    frames, certainly if
    it is their first time out in web design. I myself was drawn
    to the lure of
    having that immutable left hand menu frame with my right hand
    side being
    able to change.
    But then I discovered templates and server side includes.

  • Why not use Jsp for  control in MVC2 ?

    hi
    i am rajendra , i am preparing interview FAQ, so please give me my Que. Ans.
    1) we are using servlet for control in MVC2 Module,then why we can not use
    Jsp for control in mvc2
    2) if we used jsp for control in mvc2 then what is disadvantage compare to if using servlet for control in mvc2
    Please give me ans. as soon as..
    Thanks.

    Are you preparing a FAQ for others or are you just cramming before an upcoming interview and someone gave you a set of questions? It looks more like the latter to me.
    If you haven't actually written any MVC based code, you won't be able to snow the interviewer. It's better to just relax, get a good night's sleep and impress them with your willingness to learn, your fit with the team and whatever real accomplishments you have to show.
    If you really want an answer to this I suggest that you try writing an MVC2 system using JSP for the controller, which is possible, and then try doing the same in a servlet, or better yet using a framework like Spring MVC or Struts to provide the servlet for you and let you concentrate on your application.

  • Apache VS Netscape Why Not Use Apache....

    Is this correct?
              I should use Netscape as a proxy server to proxy jsp and servlet requests to
              a weblogic cluster because the libproxy.so module has special functionality
              in dealing with weblogic clusters.
              I should NOT use Apache because it does not handle the in-memory replication
              of Sessions to the weblogic cluster.
              Why shouldn't I use Apache in a clustered environment?
              Thanks
              Michael Schreiber
              

                   Your assumption is correct. Currently there is no Apache plugin to
              handle session replication for a clustered environment in 4.51. You can
              use Apache's mod_proxy for simple proxying, but that will not handle
              failover or load balancing. An apache plugin for clustered setups will
              be available in Weblogic 5.0 (currently in public beta).
                                  - Mike
              Michael Schreiber wrote:
              >
              > Is this correct?
              >
              > I should use Netscape as a proxy server to proxy jsp and servlet requests to
              > a weblogic cluster because the libproxy.so module has special functionality
              > in dealing with weblogic clusters.
              >
              > I should NOT use Apache because it does not handle the in-memory replication
              > of Sessions to the weblogic cluster.
              >
              > Why shouldn't I use Apache in a clustered environment?
              >
              > Thanks
              > Michael Schreiber
              

  • Why not use Redo log for consistent read

    Oracle 11.1.0.7:
    This might be a stupid question.
    As I understand if a select was issued at 7:00 AM and the data that select is going to read has changed at 7:10 AM even then Oracle will return the data that existed at 7:00 AM. And for this Oracle needs the data in Undo segments.
    My question is since redo also has past and current information why can't redo logs be used to retreive that information? Why is undo required when redo already has all that information.

    user628400 wrote:
    Thanks. I get that piece but isn't it the same problem with UNDO? It's written as it expires and there is no guranteee until we specifically ask oracle to gurantee the UNDO retention? I guess I am trying to understand that UNDO was created for effeciency purposes so that there is less performance overhead as compared to reading and writing from redo.And this also you said,
    >
    If data was changed to 100 to 200 wouldn't both the values be there in redo logs. As I understand:
    1. Insert row with value 100 at 7:00 AM and commit. 100 will be writen to redo log
    2. update row to 200 at 8:00 AM and commit. 200 will be written to redo log
    So in essence 100 and 200 both are there in the redo logs and if select was issued at 7:00 data can be read from redo log too. Please correct me if I am understanding it incorrectly.I guess you didnt understand the explaination that I did. Its not the old data that is kept. Its the changed vector of Undo that is kept which is useful to "recover" it when its gone but not useful as such for a select statement. Whereas in an Undo block, the actual value is kept. You must remember that its still a block only which can contain data just like your normal block which may contain a table like EMP. So its not 100,200 but the change vectors of these things which is useful to recover the transaction based on their SCN numbers and would be read in that order as well. And to read the data from Undo, its quite simple for oracle to do so using an Undo block as the transaction table which holds the entry for the transaction, knows where the old data is kept in the Undo Segment. You may have seen XIDSEQ, XIDUSN, XIDSLOT in the tranaction id which are nothing but the information that where the undo data is kept. And to read it, unlke redo, undo plays a good role.
    About the expiry of Undo, you must know that only INACTIVE Undo extents are marked for expiry. The Active Extents which are having an ongoing tranaction records, are never marked for it. You can come back after a lifetime and if undo is there, your old data would be kept safe by oracle since its useful for the multiversioning. Undo Retention is to keep the old data after commit, something which you need not to do if you are on 11g and using Total Recall feature!
    HTH
    Aman....

  • Why not use iPhone in car as active noise canceller.

    The iPhone uses noise cancellation during conversations. Why not make that available in the car through the car audio to quiet the interior at all times?

    I have one of those stereos bought from Ebay, no badge, no name, and with multitude of functions,and a mic attached to my visor. Once it is paired with Iphone, all my music and calls go through the car stereo.
    for applications that do not direct Audio through BT such as CoPilot (GPS navigation) I connect the Iphone through headset socket and into the stereo AUX input and works great (all sounds, voice,calls) go through it. One disadvantage of this method is that I can't listen to the radio. Well you cannot have it all. Or perhaps there is a Radio application where it plays in the background while I still use my GPS application.

  • Why not use DateFormat?

    I've noticed a few posts recently that deal with how to calculate the differences between dates (example, example), and it seems like folks are shying away from DateFormat to parse dates for these calculations. Incidentally, the OPs are running into month offset problems as well when trying to calculate using Calendars.
    DateFormat seems much more simple to me than all the other parsing rigmarole, but I wonder if I'm missing something. Is there a good reason to not use this technique in the listed examples, or can it be chalked up to unfamiliarity with the API?

    In "Literate Programming," Donald Knuth wrote "We
    should forget about small efficiencies, about 97% of
    the time. Premature optimization is the root of all
    evil." That'll garner the remaining Dukes. Excellent words to program by, even (especially) for newbies such as I.

  • Sun.* packeges source code

    Kindly can somebody tell me where from i can down load the source code of sun.*(sun.misc.ProxyGenerator) packages that are being used in JDK classes. kindly tell me.

    Why Developers Should Not Write Programs That Call 'sun' Packages
    The classes that Sun includes with the Java 2 SDK, Standard Edition, fall into package groups java.*, javax.*, org.* and sun.*. All but the sun.* packages are a standard part of the Java platform and will be supported into the future. In general, packages such as sun.*, that are outside of the Java platform, can be different across OS platforms (Solaris, Windows, Linux, Macintosh, etc.) and can change at any time without notice with SDK versions (1.2, 1.2.1, 1.2.3, etc). Programs that contain direct calls to the sun.* packages are not 100% Pure Java. In other words:
    The java.*, javax.* and org.* packages documented in the Java 2 Platform Standard Edition API Specification make up the official, supported, public interface.
    If a Java program directly calls only API in these packages, it will operate on all Java-compatible platforms, regardless of the underlying OS platform.
    The sun.* packages are not part of the supported, public interface.
    A Java program that directly calls into sun.* packages is not guaranteed to work on all Java-compatible platforms. In fact, such a program is not guaranteed to work even in future versions on the same platform.
    For these reasons, there is no documentation available for the sun.* classes. Platform-independence is one of the great advantages of developing in the Java programming language. Furthermore, Sun and our licensees of Java technology are committed to maintaining backward compatibility of the APIs for future versions of the Java platform. (Except for code that relies on serious bugs that we later fix.) This means that once your program is written, the class files will work in future releases.
    Each company that implements the Java platform will do so in their own private way. The classes in sun.* are present in the SDK to support the Sun implementation of the Java platform: the sun.* classes are what make the Java platform classes work "under the covers" for the Sun Java 2 SDK. These classes will not in general be present on another vendor's Java platform. If your Java program asks for a class "sun.package.Foo" by name, it may fail with ClassNotFoundError, and you will have lost a major advantage of developing in Java.
    Technically, nothing prevents your program from calling into sun.* by name. From one release to another, these classes may be removed, or they may be moved from one package to another, and it's fairly likely that their interface (method names and signatures) will change. (From the Sun point of view, since we are committed to maintaining the Java platform, we need to be able to change sun.* to refine and enhance the platform.) In this case, even if you are willing to run only on the Sun implementation, you run the risk of a new version of the implementation breaking your program.
    In general, writing java programs that rely on sun.* is risky: they are not portable, and are not supported.
    ~

  • Why can't I edit the source code?

    Updating an existing site that was created in Front Page. Am using DW CS4. Must be missing something totally obvious, but when I have pages open in split view, I'm unable to edit the source code. Any thoughts? I can make changes to the CSS, but direct editing in the source code seems to be unavailable.

    > Is it because I didn¹t download the site through DW, that I can¹t edit the source
    code?
    No.  HTML is HTML no matter who writes it.
    This page is definitely a template controlled page, but it is one that has been 'hacked' in the sense that someone has removed the link to the template page from the head of this document (there should be a link to the template page just below the <html> tag).  For example, if you look at the code on the about.htm page, you will see this -
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"><head><!-- InstanceBegin template="/Templates/main.dwt" codeOutsideHTMLIsLocked="false" -->
    And by the way, I will say that this looks suspiciously like a DW page not a FrontPage page....
    What edits are you wanting to make to this page?

Maybe you are looking for