Results 1 to 2 of 2
  1. #1
    maheshsardar is offline Member
    Join Date
    Aug 2010
    Rep Power

    Unhappy pack200 .gz file unpack and create .jar file in browser(speed test).

    I have to test the speed after loading the .gz file in browser and I am having java applet based web application(Hello word) whose HelloWorld.jar file size is 743byets and using pack200 tool compressed to .gz(321 bytes)files.

    1) created file

    Java Code:
     import java.applet.Applet;
        import java.awt.Graphics;
        public class HelloWorld extends Applet {
            public void paint(Graphics g) {
                g.drawString("Hello word!", 50, 25);

    Created HelloWorld123.jar file with this class

    2)Main html file hello.html
    XML Code:
        <meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
        <meta HTTP-EQUIV="Expires" CONTENT="-1">
      <meta HTTP-EQUIV="accept-encoding" CONTENT="gzip,deflate">
      <meta http-equiv="content-type" content="text/html"> 
        Here is the output of my program:
           <APPLET CODE    = "HelloWorld.class" ARCHIVE = "HelloWorld123.jar" WIDTH   = "200" HEIGHT  = "50">
            <param name="java_arguments" value="-Djnlp.packEnabled=true"/>

    3)First time tried to load the class file from the jar file it works fine(HelloWorld.class is loading in the browser).

    XML Code:
     <APPLET CODE    = "HelloWorld.class" ARCHIVE = "HelloWorld123.jar" WIDTH   = "200" HEIGHT  = "50">

    4) created different .gz file with same jar file(pack200 tool).

    pack200 --gzip -E9 HelloWorld123.gz HelloWorld123.jar

    pack200 --no-gzip -E9 HelloWorld123.jar.pack HelloWorld123.jar

    pack200 --gzip -E9 HelloWorld123.jar.pack.gz HelloWorld123.jar

    and tried these files with the above html code

    XML Code:
     <APPLET CODE    = "HelloWorld.class" ARCHIVE = "HelloWorld123.gz"  WIDTH   = "200" HEIGHT  = "50" >


    XML Code:
     <APPLET CODE    = "HelloWorld.class" ARCHIVE = "HelloWorld123.jar.pack"  WIDTH   = "200" HEIGHT  = "50" >


    XML Code:
     <APPLET CODE    = "HelloWorld.class" ARCHIVE = "HHelloWorld123.jar.pack.gz"  WIDTH   = "200" HEIGHT  = "50" >

    while loading this class I found that class loader error on sun console(as follows).
    Java Code:
    liveconnect: Invoking JS method: document
    liveconnect: Invoking JS method: URL
    basic: Referencing classloader: sun.plugin.ClassLoaderInfo@23d275, refcount=1
    basic: Added progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@e85825
    basic: Loading applet ...
    basic: Initializing applet ...
    basic: Starting applet ...
    basic: completed perf rollup
    network: Connecting [url]http://localhost:7020/designer/details/HelloWorld123.pack.gz[/url] with proxy=DIRECT
    network: Connecting socket://localhost:7020 with proxy=DIRECT
    network: Connecting [url]http://localhost:7020/designer/details/HelloWorld123.pack.gz[/url] with cookie "JSESSIONID=gGsmMJmbGmZhtyKTn1v2FWvcRkFhN18Dpm81R2RLM6LYvYfFLf25!-726539454"
    network: Downloading resource: [url]http://localhost:7020/designer/details/HelloWorld123.pack.gz[/url]
        Content-Length: 314
        Content-Encoding: null
    load: class HelloWorld.class not found.
    java.lang.ClassNotFoundException: HelloWorld.class
        at sun.applet.AppletClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.applet.AppletClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.applet.AppletClassLoader.loadCode(Unknown Source)
        at sun.applet.AppletPanel.createApplet(Unknown Source)
        at sun.plugin.AppletViewer.createApplet(Unknown Source)
        at sun.applet.AppletPanel.runLoader(Unknown Source)
        at Source)
        at Source)
    basic: Exception: java.lang.ClassNotFoundException: HelloWorld.class
    Ignored exception: java.lang.ClassNotFoundException: HelloWorld.class

    In the About detail I can get that HelloWorld123.pack.gz or HelloWorld123.jar.gz or HelloWorld123.jar.pack.gz is downloading.

    My question is will browser decompress the .gz file to .jar file internally ? or I am missing some coding for .gz file decompression ?.
    Last edited by maheshsardar; 08-03-2010 at 01:53 PM.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power

Similar Threads

  1. Replies: 1
    Last Post: 03-31-2010, 09:04 PM
  2. Replies: 2
    Last Post: 03-22-2010, 09:55 AM
  3. Why do you only compile the Test file?
    By Java Riser in forum New To Java
    Replies: 8
    Last Post: 02-23-2010, 03:20 AM
  4. How to create .exe file using .class file
    By pradnya in forum New To Java
    Replies: 8
    Last Post: 04-18-2009, 01:50 AM
  5. Test internet speed
    By kalpo in forum Networking
    Replies: 0
    Last Post: 03-31-2009, 01:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts