Advanced Applet Resource Loading

Hi All,
Java 6 Resource loading works as follows with a remote resource:
* First tries to locate the resource as a system resource; then, if not found,
* Searches through the resources in archives (JAR files) already loaded in this CODEBASE; then, if not found,
* Uses CODEBASE and attempts to locate the resource (which may involve contacting a remote site).
Due to size issues of multimedia image and sound files resources need to be cached, and at the same time depending on the Applet connection speed this can be a time consuming process taking several minutes, which is an unacceptable option. I am looking for a more elequent solution than my current one which goes as following:
1. Create fully signed and indexed Jar files.
2. Start a custom classloader Applet that will attempt to launch the current task that will playback multimedia (audio, images, video). Since each Jar file is large, and contains multiple multimedia files, and the download time is long if a particular resource cannot be located in the classpath, the assumption is it is because the Jar file is downloading and has not completed, therefore to get the user moving we will make an HTTPURLConnection request to the web server for each JAR's index list, and then we download the resource directly from a web server Jar URL.
This solution will require custom caching and a bunch of other issues like versioning, and such. Any better ideas?
Thanks,
Aaron

Doubleposted: [http://forums.sun.com/thread.jspa?threadID=5377115]. Please don't do that. Stick to one topic. Do not use browser's back button to edit the recently posted message, you're going to repost it again otherwise. Use the message's edit button for it.

Similar Messages

  • Status about  Applet is loading

    Hi,
    My applet contains scrollpane and on the canvas the graphics were drawn. This applet loads on a browser. But it is taking time to load and i would like to show the status or progress bar so that user can know that applet is loading.
    Thanks in advance
    punni

    This may help:
    public void init() {   
       Container c = getContentPane();
       //create progress bar and loading label
       progressBar = new JProgressBar(0, 7);
       progressBar.setValue(0);
       progressBar.setStringPainted(true);   
       final JPanel progressPanel = new JPanel();
       progressPanel.add(progressBar,BorderLayout.SOUTH);
       JPanel panel = new JPanel(new BorderLayout());
       panel.add(new JPanel(),BorderLayout.NORTH);
       panel.add(new JLabel("<HTML><B>Loading...</B></HTML>",SwingConstants.CENTER),BorderLayout.CENTER);
       panel.add(progressPanel,BorderLayout.SOUTH);
       c.add(panel,BorderLayout.CENTER);
       doTimeConsumingStuff();
    }//end init method
       * Retrieve data from the database and build and display the currently selected Map.
       * Builds a MapData object after retrieving the data from the database. Builds all
       * the panels and adds everything to the Applet so that it can be displayed.                           
       private void doTimeConsumingStuff() {
          final JApplet applet = this;
          //SwingWorker is a class that SUN programmers made. 
          //You can find its code in 'The Java Tutorial'
          final SwingWorker worker = new SwingWorker() {
             * Whatever you put in this method is meant to take awhile.  So,
             * this is the portion that is actually ran in a thread separate from
             * the main thread.
             public Object construct() {
                //do your long stuff here.
                //note, in differring locations of your time-consuming, code, do:
                progressBar.setValue(1);
                progressBar.setValue(6);
                return yourObjectRef; //this can be any object
             }//end construct
             *  Executes all its code in the event-dispatching thread.  We want
             *  the GUI building to be done in the event dispatch thread. 
             *  Because we are using SUN's SwingWorker class, we don't need to
             *  wrap the GUI building portion in a SwingUtilities.invokeLater()
             *  method.  We just put the GUI building in the finished method of
             *  the SwingWorker and it will accomplish the same thing.
             public void finished() {    
                final Container c = getContentPane(); //applet's
                c.removeAll();  //removes the progress bar
                c.add({add your components});
                c.validate();               
             }//end finished
          };//end SwingWorker class
          worker.start();     
       }//end buildMap method

  • No return in JS when accessing an applet in loading process

    When I try to access a property or a method of an applet which is
    not completely loaded by the plug-in, my javascript instruction
    never returns. Not even an exception or a null. The CPU is 100% busy
    with the netscape.exe for ever. When I close the browser, I get a
    Dr. Watson.
    Context :
    Netscape 6.2, plug-in 1.3.1 or
    Netscape 7.0, plug-in 1.4.0
    My purpose is to call the applet just after everything is put in place:
    the applet is loaded, ready is work and laid out on screen. So I do
    the call on the BODY onload event. It's fine with NN4.7 or IE5.5 and
    their internal JVM because when the event fires, the applet is ready.
    The problem is with the plug-in. I know that the onload event fires
    as soon as the HTML is ready, independently from the applet which is
    taken in charge by the plug-in. The availability of the applet takes
    some time because it comes from a signed Jar from a protected area of
    the web server. So you have to walk through two additional steps:
    authentify yourself with the server (first popup) and grant session
    privileges to the applet code (second popup). During this time, onload
    has been executed. I know I have to check if the applet is up and if
    not try again later with a setTimeout().
    But how to check the readiness of the applet? When I try to read
    whatever from it too soon, the code will never return !
    To demonstrate the no-return, just put an alert and wait for the applet
    to be loaded and fully active. Then you can have a return from it.
    Don't forget: because of the user prompts (authentication and grant),
    I can't determine a time to delay the check.
    The code:<HTML>
    <HEAD>
    <SCRIPT>
    function initApplet() {
    // If you uncomment the following alert() and wait
    // for the applet to be fully loaded and running, it will be OK.
    // If you don't, "document.applets[0].isActive" will never return.
    // alert("wait")
    if (document.applets.length != 0
      && document.applets[0].isActive
      && document.applets[0].isActive()) updateApplet()
    else setTimeout("initApplet()",1000)
    function updateApplet() {
    alert("call the applet")
    </SCRIPT>
    </HEAD>
    <BODY onload="initApplet()">
    <APPLET code="test.class" width="760" height="220" name="theApplet"
    archive="theSignedJar.jar" MAYSCRIPT>
    </APPLET>
    </BODY>
    </HTML>

    I am having a very similar problem in Netscape 6.2 or later. (It never occurs in Internet Explorer) The applet can contain a few or many (in the 1000's) of applet parameters.
    I am following the same pattern to determine when the applet is loaded (by referencing a flag that is set to true through the applet), which seems pretty standard. The applet is loaded, and the flag is set, but when I begin to process the parameters, the first parameter that is examined is returned as null, even though it is included as an applet parameter in the HTML file that is generated. FYI the first parameter processed is the last one included in the source file. The worst part about this error is that the error seems random. Sometimes it works; other times it doesn't.
    Has anybody ever seen documentation as to how the parameters are loaded into memory, i.e. in what order? Does anybody know the algorithm used by the runtime system to find a parameter when a call to getParameter() is made?
    Any insight would be greatly appreciated!

  • How to get applet to load text file and use it

    The applet is loaded from my site and the short text file is updated by a perl script in my cgi-bin, which is called whenever someone loads the html that loads my applet.
    The text file is just a counter string and I'd like to use it to display #.gif's at a certain place on the applet window (no problem there if I can get the text file into the applet).
    How would I get the applet to load the text file into a string or array?
    It has a running thread and I'd like it to update it periodically.

    I believe you can do that with Class.getResourceAsStream.
    Or you can do it explicitly with java.net.* stuff.

  • JVM crashed when applet is loaded in browser

    when applet is loaded in browser after some time JVM crashedwith hs error log.
    i am using
    JRE 1.6.0_10,
    1GB RAM,
    XP SP3,
    IE6
    Error log
    # An unexpected error has been detected by Java Runtime Environment:
    # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d02bd1d, pid=6032, tid=4772
    # Java VM: Java HotSpot(TM) Client VM (11.0-b15 mixed mode windows-x86)
    # Problematic frame:
    # C [awt.dll+0x2bd1d]
    # If you would like to submit a bug report, please visit:
    # http://java.sun.com/webapps/bugreport/crash.jsp
    # The crash happened outside the Java Virtual Machine in native code.
    # See problematic frame for where to report the bug.
    #

    It appears from the following statement that a native code process failed when called by the jvm.
    The crash happened outside the Java Virtual Machine in native code.Not much more can be said. The cause does not appear to Java code.

  • Java applet wont load

    There is a website on our intranet that has a window in it that is written in java. The applet loads without conflict in Windows NT, but will not load in XP. I have loaded every Java Plug-in from 1.1.1 - 1.4.1_02. I need this applet to load in XP?????????

    honestly, i find XP rather java unfriendly myself. Thats why i think running c compilers on Unix is the most feasible solution , given that most computer students would have a unix or linux platform in their labs.
    regards,
    Joshua.
    With unix, all things are possible.

  • Java Applet Wont Load Past 80%

    Someone is running a java based paint chat off of their home system, so far all of us have been able to load it all the way, except for one person who can't seem to get the applet to load past 80%.
    She says she's got the latest update for OS X and she's gotten it to load before. She's tried updating Java and restarting her system. We don't think it's a firewall, seeing as other people can access it and she doesn't think she's running one.
    Any thoughts on what the issue could be would be greatly appreciated.

    Have her go to this Sun page and test her Java installation.
    http://java.com/en/download/help/testvm.jsp
    If there's no problem, she should look for a cause other than Java/applets.
    If there is a problem, the page has troubleshooting information.

  • Problem installing Circuit Design Suite - "Error while initializing resource loader"

    I am attempting to install v 10.0.1 of the Circuit Design Suite (Education and Student Edition).  Immediately after starting the install process I get the message "Error while initializing Resource Loader!" and the installer exits.  My computer meets the minimum system requirements (512 MB RAM, 20 GB free hard drive space, Windows XP, etc).
    Any suggestions for how to work around this problem so I can get Multisim installed?

    Hi John,
    I'm not sure if you still have issues with the Multisim installer. But just in case here are some comments:
    Are you using a CD to install Multisim? If yes, try copying the installer to your hard drive.
    Try installing Multisim on a different machine.
    Apparently the Resource Loader is related to Java, try un-reinstalling it, upgrading to the latest release, etc.
    Let us know how it works,
    Fernando D.
    National Instruments

  • Deermining an applet is loaded and initialized

    In the HTML of a web page how can I determine or be notified that an applet is loaded and initialized similar to "onload=foo()" on the <body> statement.
    At least in NS 7+ the <body> onload executes before the applets contained in the body are initialized.
    I also tried to use onload on the <applet> statement and while it was accepted by NS 7.1, the target JS function was not executed.

    My applets load before the javascript for the onLoad event of the body tag fires. I do the following javascript and can access methods from the applet. However, please note that the applet displays with just a loading progress bar. I cause the javascript to make the applet do the lengthy gui display rather than displaying all components on loadup. I hope this is making sense.
    //javascript
    function doOnLoad() {
       var a = document.yourAppletName;
       a.callSomeAppletMethod();
    //html
    <BODY onLoad="return doOnLoad();">

  • I have download firefox 4 beta but now in some websites can not open. applet not load properly

    I just download fire 4 beta on my windows vista. Can not open in some websites. the message applet not load properly please reload the page

    Your More system details list doesn't show the Java plugin as installed.
    Update the [[Java]] plugin to the latest version.
    *http://kb.mozillazine.org/Java
    *http://www.oracle.com/technetwork/java/javase/downloads/index.html (Java Platform: Download JRE)

  • Applet not loading in some environments

    Hi,
    We have an applet that works for 99% of our users but for one user the applet does not start. Are there any specific proxy / browser settings that could prevent the applet from loading properly? Outputs from the java console for the working users show the following lines:
    basic: Applet loaded.
    basic: Applet resized and added to parent container
    basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 116394 us, pluginInit dt 399250 us, TotalTime: 515644 us
    basic: Applet initialized
    basic: Removed progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@1abab88
    basic: Applet made visible
    basic: Starting applet
    basic: completed perf rollup
    Start Method
    basic: Applet started
    basic: Told clients applet is started
    In the example where we have an issue we only see the following lines:
    basic: Loading applet ...
    basic: Initializing applet ...
    basic: Starting applet ...
    basic: completed perf rollup
    basic: Stopping applet ...
    basic: Removed progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@b51404
    basic: Destroying applet ...
    basic: Disposing applet ...
    basic: Joining applet thread ...
    basic: Joined applet thread ...
    basic: Finding information ...
    basic: Releasing classloader: sun.plugin.ClassLoaderInfo@a89ce3, refcount=0
    basic: Caching classloader: sun.plugin.ClassLoaderInfo@a89ce3
    basic: Current classloader cache size: 1
    basic: Done ...
    basic: Quiting applet ...
    It seems like for some reason its attempting to start but then instantatly stops .... we don't see any exceptions in console.
    Relatively new to applets so any advice would be appreciated

    tschodt wrote:
    What do you see with
    - a different user on the same workstation
    - the same user on a different workstation
    953875 wrote:The same user has tried different machines within the network. Another user has tried on a different machine on the same network with the same results. All machines sit behind a proxy server and browser settings are managed centrally.You are not actually answering the question.
    I deduce that
    The same user has tried different machines within the networkproduces the same behaviour.
    Another user has tried on a different machine on the same network with the same results.A different user on a different machine is not likely to tell us anything.
    All machines sit behind a proxy server and browser settings are managed centrally.So, the profile for this user may be corrupt.
    Create a new profile for this user.

  • Yahoo chess Applet not loading in Firefox

    When I am at Yahoo Games, the pop up window for Chess opens, but never loads. I tried it in IE and it works fine - so the problem comes down to Firefox.
    When I click on a games room - and window pops up and asks to punch in a code (to avoid spam). This pop up works fine, I then proceed to punch in the code and then I go to another pop up window where the Chess Game normally loads. Only now it doesn't load at all.
    it says to... Wait 3 minutes for applet to load... Click '''here''' if applet fails to load. Normally I've never had to wait 3 minutes before (ever) - now, even if I wait, it still doesn't load.
    Any help would be greatly appreciated.

    Still not working in Firefox! I can play fine in IE. I have tried everything from uninstalling java and reinstalling, clearing cache, etc... nothing works! Is there not anyone at Firefox that knows of a solution?

  • How can i hnow the applet had load complet by javascript?

    hi,how can i hnow the applet had load complet by javascript?
    my applet load by <object> tag,
    i add a "onload" event listener to the html page's <body> tag,but the event listener is call by the page load,
    but ,the applet sometime has not loaded complet,so how can i know the applet had loaded complet!
    the <OBJECT>has some method to check the applet load status??
    3KS!

    You can have your applet call some javascript to inform that it is loaded. Make the call from your
    applet's start method
    Suppose you have a javascript function called "appletReady()"
    which sets a ready variable to true or whatever.
    Now in your start method of your applet you can do the following:
           JSObject win = null;
            try
                win = (JSObject)JSObject.getWindow((Applet)this);
                if (win == null)
                    System.err.println("JSObject window was null");
                else
                        win.call("appletReady",null);
            catch (Exception jse)
                System.err.println("Exception: " + jse);
            }Make sure you import netscape.javascript.
    And when you compile use the appropriate jaws.jar in your classpath
    It should be found under jre/lib of your JDK installation.
    I hope this helps.

  • Where can I find more advance swing resource?

    Hi,
    I have got a bottleneck about Swing,though I studied in the Swing for a long while.
    Could anyone tell me how to get a more advance swing resource,such as website
    book, document...etc?
    Thank a lot!!

    Try these links:
    http://www2.gol.com/users/tame/swing/examples/SwingExamples.html
    http://www.dickbaldwin.com/toc.htm
    Hope it helps.

  • Is there any way to force the applet to load the file without using cache?

    Hi,
    I have the applet that renders some data from a file specified as the parameter. The problem is that the user can do something, that changes the input file and reloads the page, but the applet renders old data (from browser cache most probably)
    Is there any way to force the applet to load the file without using cache?
    Regards,
    Zdenek

    The initial view (IV) settings within a PDF file are static tags - they can't be made to dynamically-adapt based on the window dimensions,it's the renderer (Acrobat, Reader, or whatever else is opening the file) that decides if and how it will follow the IV requested by the file header.
    It would be possible to use a Page Open action on the first page of the file, which does some nasty math with the various doc.*WindowRect objects to work out how much "wasted" space there is, and then set the doc.layout and doc.zoomType properties - but page actions are a different concept to IV as the zoom will reset itself every time that page is viewed. Users don't like their application apparently fiddling with the zoom level without being told to!

Maybe you are looking for