Pack200 problems

Has anyone ever had any troubles with the pack200 tools bundled with the jdk? I've recently run into an issue where packing a jar file with the -E9 flag (Use maximum effort for compression) fails (more specifically the follow up unpacking does "bad ref") while the -E8 flag shows no signs of the same problem.

ok i fixed it now like this:
if(usePack)
     String serverJavaVersion = System.getProperty("java.specification.version");
     String clientJavaVersion = request.getHeader("ua-java-version");
     usePack = !(clientJavaVersion != null && serverJavaVersion != null && serverJavaVersion.indexOf("1.6") >= 0 && clientJavaVersion.indexOf("1.5") >= 0);
}so that when the server is java 6 and the client is java 5 then pack will not be used. If anybody has a better idea to forge the packer into a better mode then i still would like to know that.

Similar Messages

  • Could not verify signing in resource (JAR + Pack200)

    It seems I always ended up getting JWS error I never have had before these days...
    Ok, long story short:
    - this is about a JavaFX 1.3.1 app with packed JARs
    - changed computer, switched from JDK 1.6.0_22 that I used for several month for signing and pack files to JDK 1.6.0_29 and JDK 1.7.0_02. This issue did not happen with JDK 1.6.0_22.
    - it's currently deployed to an internal web server for testing purposes, files and URL are correct and can be reached from my workstation.
    - every single JNLP file validates OK with JaNeLA.
    - the certificate used to sign the libs is valid.
    - the offending JAR file report as being Ok and signed when checked with jarsigner.
    The error from Java Web Start is:
    >
    Unable to launch the application.
    Error: Could not verify signing in resource: http://devlin01.noumea.spc.local/~fabriceb/Web/TUMAS/lib/OFP-fx.jar.pack.gz
    >
    The exception is:
    com.sun.deploy.net.JARSigningException: Could not verify signing in resource: http://devlin01.noumea.spc.local/~fabriceb/Web/TUMAS/lib/OFP-fx.jar.pack.gz
         at com.sun.deploy.security.JarVerifier.authenticateJarEntry(Unknown Source)
         at com.sun.deploy.security.EnhancedJarVerifier.validate(Unknown Source)
         at com.sun.deploy.cache.CacheEntry.processJar(Unknown Source)
         at com.sun.deploy.cache.CacheEntry.access$2200(Unknown Source)
         at com.sun.deploy.cache.CacheEntry$9.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sun.deploy.cache.CacheEntry.writeFileToDisk(Unknown Source)
         at com.sun.deploy.cache.Cache.downloadResourceToTempFile(Unknown Source)
         at com.sun.deploy.cache.Cache.downloadResourceToCache(Unknown Source)
         at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
         at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
         at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
         at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
         at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
         at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
         at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source)
         at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
         at java.util.concurrent.FutureTask.run(Unknown Source)
         at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)The wrapped exception is:
    java.lang.SecurityException: SHA1 digest error for org/spc/ofp/javafx/scene/control/dialog/TitleLabel$TitleLabel$Script.class
         at sun.security.util.ManifestEntryVerifier.verify(Unknown Source)
         at java.util.jar.JarVerifier.processEntry(Unknown Source)
         at java.util.jar.JarVerifier.update(Unknown Source)
         at java.util.jar.JarVerifier$VerifierStream.read(Unknown Source)
         at com.sun.deploy.security.JarVerifier.readAndMaybeSaveStreamTo(Unknown Source)
         at com.sun.deploy.security.JarVerifier.authenticateJarEntry(Unknown Source)
         at com.sun.deploy.security.EnhancedJarVerifier.validate(Unknown Source)
         at com.sun.deploy.cache.CacheEntry.processJar(Unknown Source)
         at com.sun.deploy.cache.CacheEntry.access$2200(Unknown Source)
         at com.sun.deploy.cache.CacheEntry$9.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sun.deploy.cache.CacheEntry.writeFileToDisk(Unknown Source)
         at com.sun.deploy.cache.Cache.downloadResourceToTempFile(Unknown Source)
         at com.sun.deploy.cache.Cache.downloadResourceToCache(Unknown Source)
         at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
         at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
         at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
         at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
         at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
         at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
         at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source)
         at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
         at java.util.concurrent.FutureTask.run(Unknown Source)
         at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)The main JNLP is:
    <jnlp spec="1.0+" codebase="http://devlin01.noumea.spc.local/~fabriceb/Web/TUMAS/" href="TUMAS-fx.jnlp">
      <information>
        <title>TUMAS development standalone version</title>
        <vendor>CPS-SPC Secretariat of the Pacific Community</vendor>
        <homepage href="http://www.tumas-project.org/"/>
        <description>Management Option Visualisation Tool</description>
        <description kind="short">Management Option Visualisation Tool</description>
        <description kind="one-line">Management Option Visualisation Tool</description>
        <description kind="tooltip">Management Option Visualisation Tool</description>
        <icon kind="default" href="MOViT.gif" width="128" height="128" size="10948"/>
        <icon kind="shortcut" href="MOViT.gif" width="128" height="128" size="10948"/>
        <icon kind="splash" href="MOViT.gif" width="128" height="128" size="10948"/>
        <offline-allowed/>
        <shortcut online="false">
          <desktop/>
          <menu submenu="TUMAS"/>
        </shortcut>
      </information>
      <security>
        <all-permissions/>
      </security>
      <update check="always"/>
      <resources>
        <java max-heap-size="800m" version="1.6+"/>
        <jar href="TUMAS-fx.jar" main="true" size="154269"/>
        <extension name="MOViT" href="MOViT.jnlp"/>
        <extension name="l2fprod-7.3" href="l2fprod-7.3.jnlp"/>
        <extension name="JFXtras-0.7" href="JFXtras-0.7.jnlp"/>
        <extension name="gnujpdf-1.7" href="gnujpdf-1.7.jnlp"/>
        <extension name="Apache-POI-3.6" href="Apache-POI-3.6.jnlp"/>
        <extension name="SwingX-1.6.1" href="SwingX-1.6.1.jnlp"/>
        <extension name="OpenMap-5.0" href="OpenMap-5.0.jnlp"/>
        <extension name="JavaFX 1.3.x Runtime" href="http://dl.javafx.com/1.3/javafx-rt.jnlp"/>
        <property name="jnlp.packEnabled" value="true"/>
      </resources>
      <application-desc main-class="com.sun.javafx.runtime.main.Main">
        <argument>MainJavaFXScript=org.spc.ofp.project.tumas.TUMAS</argument>
        <argument>--development</argument>
      </application-desc>
    </jnlp>The JNLP which contains the offending lib is:
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="http://devlin01.noumea.spc.local/~fabriceb/Web/TUMAS/" href="MOViT.jnlp">
        <information>
            <title>MOViT</title>
            <vendor>CPS-SPC Secretariat of the Pacific Community</vendor>
            <homepage href="http://www.tumas-project.org/"/>
            <description>Management Option Visualisation Tool</description>
            <offline-allowed/>
        </information>
        <security>
           <all-permissions/>
        </security>
        <resources>
           <jar href="lib/OFP-core.jar" part="MOViT" size="384817"/>
           <jar href="lib/OFP-GIS.jar" part="MOViT" size="10608"/>
           <jar href="lib/OFP-fx.jar" part="MOViT" size="2325354"/>
           <jar href="lib/OFP-fx-mappane.jar" part="MOViT" size="3277991"/>
           <jar href="lib/MFCL-IO.jar" part="MOViT" size="82454"/>
           <jar href="lib/MOViT-templates.jar" part="MOViT" size="5142641"/>
           <jar href="lib/MOViT-ztm.jar" part="MOViT" size="59484"/>
           <jar href="lib/MOViT-ztp.jar" part="MOViT" size="56450"/>
           <jar href="lib/MOViT-zte.jar" part="MOViT" size="41706"/>
           <jar href="lib/MOViT-fishery.jar" part="MOViT" size="66291"/>
           <jar href="lib/MOViT-fx.jar" part="MOViT" size="3282871"/>
           <jar href="lib/SPINiT-fx.jar" part="MOViT" size="332428"/>
           <property name="jnlp.packEnabled" value="true"/>
        </resources>
        <component-desc/>
    </jnlp>The following command lines are used when packing + signing the file (extra private bits have been removed) :
    ► Normalizing file: "<path to file>OFP-fx.jar"
    Executing: "C:\Program Files (x86)\Java\jdk1.6.0_29/bin/pack200" --repack --effort=9 --segment-limit=-1 --modification-time=latest --strip-debug "<path to file>OFP-fx.jar"
    process exited with error code: 0
    ► Signing file: "<path to file>OFP-fx.jar"
    Executing: "C:\Program Files (x86)\Java\jdk1.6.0_29/bin/jarsigner" -verify "<path to file>OFP-fx.jar"
    process exited with error code: 0
    Executing: "C:\Program Files (x86)\Java\jdk1.6.0_29/bin/jarsigner" -tsa <timestamp server> -J-Dhttp.proxyHost=<our proxy host> -J-Dhttp.proxyPort=<our proxy port> -keystore <our store> -storepass <our password> "<path to file>OFP-fx.jar" <our alias>
    process exited with error code: 0
    ► Packing file: "<path to file>OFP-fx.jar"
    Executing: "C:\Program Files (x86)\Java\jdk1.6.0_29/bin/pack200" "<path to file>OFP-fx.jar.pack.gz" "<path to file>OFP-fx.jar"
    process exited with error code: 0Any idea, besides reinstalling an older JDK and/or runtime?

    bouye wrote:
    Thanks for the suggestion and let's hop they put some process to prevent similar issues from hapening again in the future.False hope. Programming is hard, release management is hard, testing is hard, people make mistakes, budget restrictions cause mistakes to slip through, etc. etc.
    The most important factor in all this really is us and more specifically our willingness to properly report problems.

  • Deployment problems that I don't know how to fix or trace - Please Help

    I have made a javafx application in netbeans where I import classes from the java library (specifically ones from java.io for writing/readning files). The program works great in the IDE, reading and writing files, but when I build it and run the .jnlp, It does not write any files or do anything that requires any of the imported functions. I have been trying for a few weeks now and have had no luck. The same thing happens when I create a brand new javafx desktop application and try to make it write a simple text file.
    My questions are these:
    1. Does someone know if I'm missing something? I tried checking the box that makes it a self signed jar and pack200 compression, no luck. This program is for running locally on the user's machine.
    2. I do not no how to check for exception traces the application may have thrown. I am using Mac OSX 10.6.6, and the latest Java and Netbeans. Can someone help me with this?
    My deadline is coming up and I don't want to rewrite the whole thing using something else. I was pleased with this javafx application until now. Please Help
    here is my test .fx file
    package savetest;
    import java.io.BufferedWriter;
    import java.io.FileWriter;
    import java.io.File;
    import java.io.IOException;
    import javax.swing.JFileChooser;
    public class Main {
        // <Generated Code by netbeans (unaltered or edited for this test)>
    function writeData(source : java.net.URI) {
            var output: BufferedWriter;
            try {
                def text = "Test Data";
                def file = new File(source);
                output = new BufferedWriter(new FileWriter(file));
                output.write(text);
                output.flush();
                output.close();
            } catch (e: IOException) {
                e.printStackTrace();
    function run (): Void {
        var design = Main {};
        var fileChooser : JFileChooser = new JFileChooser;
        var goalURI : java.net.URI;
        javafx.stage.Stage {
            title: "Main"
            scene: design.getDesignScene ()
         if (fileChooser.APPROVE_OPTION == fileChooser.showSaveDialog(null)) {
           goalURI = fileChooser.getSelectedFile().toURI();
        writeData(goalURI);
    }

    Hello user,
    You can see the traces of your application from java console which will automatically appears when your application is running on browser. In MAC OSX the java console icon appears at top right bottom (tray icon) and you can view the console from their.
    Please trace the exception what you have got so that we could find the real problem.
    Thanks,
    narayan

  • Why Java Web Start doesn't support Pack200 out-of-the-box?

    Hello All,
    Why Java Web Start doesn't support Pack200 out-of-the-box? I was hoping that Java 6 would make things easier by adding direct support for Pack200 in Java Web Start and JNLP without needing to use servlets, etc.? All my clients are Java 5 or above so I can't push the Pack200 compressed version of the jar to every single one of them and there is no selection process needed. But I can't do it because of the servlet or complex Apache server setup requirement (it would be a headache to get customers' web server admins to set up Apache or whatever web server that way).
    My question is why is there unwillingness to add Pack200 support directly to Java Web Start and JNLP so that you can start Pack200 compressed jars just like you would start any jar using Java Web Start? Is te a technical problem?
    Thank you,
    Mete Kural

    Hallo,
    I didn�t try it, but the webstart FAQ�s read:
    Can I use Pack200 compression with the JnlpDownloadServlet?
    Yes. The JnlpDownloadServlet distributed in the samples directory of the JDK now supports Pack200. If you deploy yourfile.jar along with yourfile.jar.pack.gz the packed file will be downloaded when the client is running Java Web Start 1.5.0 or later.
    http://java.sun.com/javase/6/docs/technotes/guides/javaws/developersguide/faq.html#217
    For further information you may want to look at
    http://java.sun.com/javase/6/docs/technotes/guides/javaws/developersguide/downloadservletguide.html#pack200
    The configuration of the server and the the servlet (as described in the second link) is as easy as it seems.
    I got it working on the first try and it was my first experience with websevers at all.
    Bye Schippe
    Message was edited by:
    Schippe

  • Forcing pack200 1.5 compatibility using 1.6

    The documentation for Pack200.Packer in Java 1.6 states:
    "In order to maintain backward compatibility, if the input JAR-files are solely comprised of 1.5 (or lesser) classfiles, a 1.5 compatible pack file is produced. Otherwise a 1.6 compatible pack200 file is produced."
    What I want to do is force all Jar files irregardless of content to be output in 1.5 compatible format. Is it possible to do this?

    I've got the same problem. People on MAC can't unpack my pack.gz files packed with 1.6. Also, I didn't find any standalone pack200 packer compatible with 1.5. pack200.exe from 1.5 bin folder contains dependencies to 1.5 dlls such as java.dll etc =(
    However, I was surprised when I packed my jar with pack200 from 1.5 and got the same file sizes on all jars!!! It's very strange. Because I completely removed 1.6 from my system.

  • Pack200 for reducing size of applets

    Hi i am working swing based applet application which is deployed on a jboss3.2.6 webserver.the jar file application.jar+ size is 140kb.i compressed the jar file using sun java pack200 technology as application.pack200.gz+ file.now the jar file size is 46kb.the jar is deployed on application.war+ file with context-path */application* on the jboss deploy path.the war file that contains the jar file also has a servlet(pack200 servlet provided in the sunjava website) to service the *.jar requests to give the compressed application.pack200.gz file to the response.outputstream() for any incoming requests for any jar file.
    When i make a request on the webbrowser as http://localhost:8080/application/application.jar+ the pack200 service servlet inside the application.war services the request to yield a compressed application.jar(46kb).+
    Now the problem arises when im calling application.jar+ from an html page(*index.html*)using THE FOLLOWING CODE
    <html>
    <html>
        <title>
    Applet APPLICATION
      </title>
      <head>
         <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">
      </head>
    <BODY>
    <Applet code='application.main.class' codebase='.' archive='../application/application.jar'>
    <param name="java_arguments" value="-Djnlp.packEnabled=true"/>
    </applet>
    </BODY>
    </HTML>The index.html file calling the applet is deployed in separate war file viewer.war+ with a context path */view* inside the jboss3.2.6 deploy path
    When i load the index.html inside the webbrowser i always get the following exception in the sun java console of the webbrowser
    Java Plug-in 1.5.0_02
    Using JRE version 1.5.0_02 Java HotSpot(TM) Client VM
    User home directory = C:\Documents and Settings\kartheepan
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    p: reload proxy configuration
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    load: class application.main.class not found.
    java.lang.ClassNotFoundException: chart.MainApplet.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 sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.IOException: open HTTP connection failed.
    at sun.applet.AppletClassLoader.getBytes(Unknown Source)
    at sun.applet.AppletClassLoader.access$100(Unknown Source)
    at sun.applet.AppletClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    ... 10 moreThe applet did not load successfully.
    When i change the coding in the pack200 service servlet to give application.jar+ as response rather the compressed application.pack200.gz+ the application loads successfully in the index.html without fail.I believe there is no problem with the pack200 service servlet provided by the sun website.I am using jdk.1.5 version of java for development with jboss3.2.6 as application server.
    i am afraid the webbrowser is not able to decompress the compressed application.jar successfully using the jdk1.5/bin/+unpack200.exe+ provided by the jdk1.5 version of java.Is it something im missing in the index.html+ code.
    i have provided the following 2 mandatory things as mentioned in the pack200 deployment guidelines
    <meta HTTP-EQUIV="accept-encoding" CONTENT="pack200-gzip,gzip">inside the <head> tag and also
    <param name="java_arguments" value="-Djnlp.packEnabled=true"/>i even tried changing the meta tag value from
    <meta HTTP-EQUIV="accept-encoding" CONTENT="pack200-gzip,gzip">to
    <meta HTTP-EQUIV="accept-encoding" CONTENT="gzip,deflate">but with no success i still get the class not found exception.
    Where i my going wrong shoul i need to write any pack200 install routine.AND IF SO WHERE DO I need to write should it be written on the server provided alongside the compressed jar or should it be present on the client machine.
    Edited by: kartheepanmirra on Jun 12, 2009 8:45 AM
    Edited by: kartheepanmirra on Jun 12, 2009 8:49 AM

    is it some thing to do with the application server jboss3.2.6 it works fine in my localsystem and adjacent systems in intranet but it fails in remote system where network access between the remote and my system is slow.I get the following exception in jboss 3.2.6
    18:34:19,875 ERROR [Engine] StandardWrapperValve[jarService]: Servlet.service() for servlet jarServi
    ce threw exception
    java.lang.NullPointerException
            at ContentType1.doGet(Unknown Source)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j
    ava:237)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
            at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j
    ava:186)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
            at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
            at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:19
    8)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
            at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
            at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:66)
            at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
            at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.ja
    va:158)
            at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
            at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
            at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
            at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11P
    rotocol.java:705)
            at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
            at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
            at java.lang.Thread.run(Thread.java:619) when it fails to decompress on the remote machine.The decompression works fine in local and adjacent machine.also i checked it myself to c whether the servlet services the compressed jar file.yes it works fine.the servlet has no problem.I think it must be some issue with the slow network.but nevertheless it should work fine in local area network.if it doesnt it will not work in internet.
    Edited by: kartheepanmirra on Jun 16, 2009 8:48 AM
    Edited by: kartheepanmirra on Jun 16, 2009 8:51 AM

  • How to use pack200 with IIS?

    I am trying to set up a Java applet that uses the Batik SVG Viewer library, which is several MB in size. In order to speed up downloads, I would like to compress the library with pack200, but there's one problem: I don't know what to do with the servlet on the deployment guide page (http://java.sun.com/j2se/1.5.0/docs/guide/deployment/deployment-guide/pack200.html) because I've never used servlets before. I found a page with instructions as to how to set up pack200 without a servlet in Apache (http://joust.kano.net/weblog/archive/2004/10/16/pack200-on-apache-web-server/) but this isn't much help because my Web server uses IIS. Could someone please explain to me how to do what is done on the Apache tutorial page in IIS, or at least how to get pack200 working at all, by any method, on an IIS server?

    Did you actually get IIS to serve up pack200 jars? I have been struggling to get IIS to do this. Most of the information I found by googling indicates that it may not be possible unless you deploy a servlet and use JNLP. I have an applet (not currently deployed with JNLP) and I configured IIS with the appropriate MIME type (.jar.pack.gz application/x-java-pack200) and I enabled http compression of static and application files. I also did the http header adjustment you mentioned previously, with no luck. Your help would be greatly appreciated.

  • Use of pack200 utility

    Hello,
    first of all I apologize for my english.
    I use an applet under Internet Information Services and I would like to use pack200 utility to reduce the dimension of my jars.
    I use eclipse and I have a jar for my applet, and distinct jars for each library.
    When I try to reduce only the jar of my applet all works fine: I use a file with extension jar.pack.gz for my applet and only simple jar for the libraries.
    The problem is that I am not able to use pack200 utility on my libraries, after the trasformation, using jar.pack.gz files also for the libraries my browser (Internet explorer) doesn't find the relative classes.
    I don't know if the problem is in the way I call the pack200 utility or I declare the applet call.
    Is there anyone that can help me?

    CarloOne wrote:
    Hello,
    first of all I apologize for my english.
    I use an applet under Internet Information Services and I would like to use pack200 utility to reduce the dimension of my jars.
    Is there anyone that can help me?Summarizing the problem.
    You have something like the following
    - MainApplet.jar, Sub1.jar, Sub2.jar
    - You pack them
    - You place the into IIS
    - You set up IIS to support this
    - You send an appropriate request from a client.
    It seems to be set up correctly because it works if you use only the single jar.
    If that is an accurate summary then then it isn't a java failure but rather an environment failure.
    Most likely sources are IIS (setup or where your pack files are) or in the client request.
    As a suggestion you might want to use a proxy http/sniffer to see what requests go between IIS and your client.

  • Can't get JnlpDownloadServlet and Pack200 working

    Hi,
    I'm running Java6 update 11. I've gotten JnlpDownloadServlet to work for Webstart files but I can't get it to work for serving pack200 files. The problem seems to be that the client (Webstart) sends "accept-encoding: gzip,deflate". Notice pack200-gzip is nowhere to be found.
    Any idea what I'm doing wrong?
    Thank you,
    Gili

    Hmm, I just noticed that the client sends "encoding-accepted: pack200-gzip,gzip" when requesting the actual JAR files (not the jnlp file) so I suppose this is working after all. Unfortunately I don't have a good HTTP sniffer to know whether the server actually sends back a pack200 file or just the original JAR.

  • A problem with threads

    I am trying to implement some kind of a server listening for requests. The listener part of the app, is a daemon thread that listens for connections and instantiates a handling daemon thread once it gets some. However, my problem is that i must be able to kill the listening thread at the user's will (say via a sto button). I have done this via the Sun's proposed way, by testing a boolean flag in the loop, which is set to false when i wish to kill the thread. The problem with this thing is the following...
    Once the thread starts excecuting, it will test the flag, find it true and enter the loop. At some point it will LOCK on the server socket waiting for connection. Unless some client actually connects, it will keep on listening indefinatelly whithought ever bothering to check for the flag again (no matter how many times you set the damn thing to false).
    My question is this: Is there any real, non-theoretical, applied way to stop thread in java safely?
    Thank you in advance,
    Lefty

    This was one solution from the socket programming forum, have you tried this??
    public Thread MyThread extends Thread{
         boolean active = true;          
         public void run(){
              ss.setSoTimeout(90);               
              while (active){                   
                   try{                       
                        serverSocket = ss.accept();
                   catch (SocketTimeoutException ste){
                   // do nothing                   
         // interrupt thread           
         public void deactivate(){               
              active = false;
              // you gotta sleep for a time longer than the               
              // accept() timeout to make sure that timeout is finished.               
              try{
                   sleep(91);               
              }catch (InterruptedException ie){            
              interrupt();
    }

  • A problem with Threads and MMapi

    I am tring to execute a class based on Game canvas.
    The problem begin when I try to Play both a MIDI tone and to run an infinit Thread loop.
    The MIDI tone "Stammers".
    How to over come the problem?
    Thanks in advance
    Kobi
    See Code example below:
    import java.io.IOException;
    import java.io.InputStream;
    import javax.microedition.lcdui.Graphics;
    import javax.microedition.lcdui.Image;
    import javax.microedition.lcdui.game.GameCanvas;
    import javax.microedition.media.Manager;
    import javax.microedition.media.MediaException;
    import javax.microedition.media.Player;
    public class MainScreenCanvas extends GameCanvas implements Runnable {
         private MainMIDlet parent;
         private boolean mTrucking = false;
         Image imgBackgound = null;
         int imgBackgoundX = 0, imgBackgoundY = 0;
         Player player;
         public MainScreenCanvas(MainMIDlet parent)
              super(true);
              this.parent = parent;
              try
                   imgBackgound = Image.createImage("/images/area03_bkg0.png");
                   imgBackgoundX = this.getWidth() - imgBackgound.getWidth();
                   imgBackgoundY = this.getHeight() - imgBackgound.getHeight();
              catch(Exception e)
                   System.out.println(e.getMessage());
          * starts thread
         public void start()
              mTrucking = true;
              Thread t = new Thread(this);
              t.start();
          * stops thread
         public void stop()
              mTrucking = false;
         public void play()
              try
                   InputStream is = getClass().getResourceAsStream("/sounds/scale.mid");
                   player = Manager.createPlayer(is, "audio/midi");
                   player.setLoopCount(-1);
                   player.prefetch();
                   player.start();
              catch(Exception e)
                   System.out.println(e.getMessage());
         public void run()
              Graphics g = getGraphics();
              play();
              while (true)
                   tick();
                   input();
                   render(g);
          * responsible for object movements
         private void tick()
          * response to key input
         private void input()
              int keyStates = getKeyStates();
              if ((keyStates & LEFT_PRESSED) != 0)
                   imgBackgoundX++;
                   if (imgBackgoundX > 0)
                        imgBackgoundX = 0;
              if ((keyStates & RIGHT_PRESSED) != 0)
                   imgBackgoundX--;
                   if (imgBackgoundX < this.getWidth() - imgBackgound.getWidth())
                        imgBackgoundX = this.getWidth() - imgBackgound.getWidth();
          * Responsible for the drawing
          * @param g
         private void render(Graphics g)
              g.drawImage(imgBackgound, imgBackgoundX, imgBackgoundY, Graphics.TOP | Graphics.LEFT);
              this.flushGraphics();
    }

    You can also try to provide a greater Priority to your player thread so that it gains the CPU time when ever it needs it and don't harm the playback.
    However a loop in a Thread and that to an infinite loop is one kind of very bad programming, 'cuz the loop eats up most of your CPU time which in turn adds up more delays of the execution of other tasks (just as in your case it is the playback). By witting codes bit efficiently and planning out the architectural execution flow of the app before start writing the code helps solve these kind of issues.
    You can go through [this simple tutorial|http://oreilly.com/catalog/expjava/excerpt/index.html] about Basics of Java and Threads to know more about threads.
    Regds,
    SD
    N.B. And yes there are more articles and tutorials available but much of them targets the Java SE / EE, but if you want to read them here is [another great one straight from SUN|http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html] .
    Edited by: find_suvro@SDN on 7 Nov, 2008 12:00 PM

  • J2ME problem with threads

    Hi all,
    I would like to ask you for a help. I need to write a small program at my university. I started to write a midlet which function would be to countdown time for sports activities. I woul like to start a new thread - the one that counts down - and at the same time make the main thread sleep. After the "countdown" thread finishes, the main thread wakes up and waits for user input. The problem is that when the "countdown" thread finishes his work, I've got Uncaught exception java/lang/NullPointerException. error and the midlet halts.
    Below you can find the code
    import java.lang.*;
    import java.util.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    public class intervals extends MIDlet implements CommandListener
    public Display ekran;
    private SweepCanvas sweeper;
    private Form rundy;
    private TextField round0, round1, round2, round3, round4, round5, round6, round7, round8;
    private long czas,x;
    private Command exitCommand;
    private Command addRound;
    private Command delRound;
    private Command start;
    private TextField repeat;
    private Form odliczanie;
    private Alert ostrz;
    Licznik thread;
    String test;
    StringItem test1;
    int parz,i,j,k;
    static int l;
    int ilrund;
    int ilpowt;
    Item sec;
    long sec1;
    public intervals()
        rundy = new Form("Interwa&#322;y sportowe");
        exitCommand = new Command("Wyj&#347;cie", Command.EXIT, 2);
        addRound = new Command("Dodaj","Dodaj rund&#281;", Command.ITEM,1);
        delRound = new Command("Usu&#324;","Usu&#324; ostatni&#261; rund&#281;", Command.ITEM,1);
        start = new Command("Start", Command.ITEM,1);
        odliczanie = new Form("Odliczanie");
        TextField dodaj(TextField kolej)
            kolej=new TextField("Podaj czas (s) rundy "+parz,null, 4, TextField.NUMERIC);//stworzenie nowej instancji do wybierania czasu trwania rundy
            if(rundy.size()==0)
                rundy.insert(rundy.size(),kolej);
                else
                    rundy.insert(rundy.size()-1, kolej);
            return kolej;
        void odliczanie(TextField round)
            monitor m=new monitor();
            k=Integer.parseInt(round.getString());
            ekran.setCurrent(odliczanie);
            thread=new Licznik(k,odliczanie);
            thread.start();
            ekran.setCurrent(rundy);
    public void startApp()// throws MIDletStateChangeException
        rundy.deleteAll();
        repeat = new TextField("Podaj ilo&#347;&#263; powtórze&#324;",null,1,TextField.NUMERIC);
        rundy.addCommand(addRound);
        rundy.addCommand(exitCommand);
        rundy.setCommandListener(this);
        Canvas obrazek = new MyCanvas();
        ekran = Display.getDisplay(this);
        ekran.setCurrent(obrazek);
        czas=System.currentTimeMillis();
        while (System.currentTimeMillis()<czas+1000)
            continue;
        ekran.setCurrent(rundy);
    public void pauseApp()
    public void destroyApp(boolean unconditional)
        notifyDestroyed();
    public void commandAction(Command c, Displayable s)
        if (c == exitCommand)
            destroyApp(false);
            notifyDestroyed();
        else if(c==addRound)
            if(rundy.size()==0)//Sprawdzenie ilo&#347;ci elementów w celu poprawnego wy&#347;wietlania liczby rund w formie
                parz=1;
                else
                parz=rundy.size();
            switch(parz)
                case 1:
                    round0=dodaj(round0);break;
                case 2:
                    round1=dodaj(round1);break;
                case 3:
                   round2= dodaj(round2);break;
                case 4:
                    round3=dodaj(round3);break;
                case 5:
                    round4=dodaj(round4);break;
                default:
                    ostrz=new Alert("Uwaga","Maksymalna liczba rund wynosi 9", null, AlertType.INFO);
                    ostrz.setTimeout(3000);
                    ekran.setCurrent(ostrz);
            if(rundy.size()==1)
                rundy.append(repeat);
                rundy.addCommand(start);
            rundy.addCommand(delRound);
        else if(c==delRound)
            if(rundy.size()!=0)
                rundy.delete(rundy.size()-2);
                if (rundy.size()==1)
                    rundy.deleteAll();
                if(rundy.size()==0)
                    rundy.removeCommand(delRound);
                    rundy.removeCommand(start);
        else if(c==start)
            ilrund=rundy.size()-1;
            if(this.repeat.size()>0)
                ilpowt=Integer.parseInt(this.repeat.getString());
            ekran = Display.getDisplay(this);
            for (i=1; i<=ilpowt;i++)
                odliczanie= new Form("Odliczanie");
                 for (j=0;j<ilrund;j++)
                    switch(j)
                         case 0:
                             odliczanie(round0);
                             break;
                         case 1:
                             odliczanie(round1);
                             break;
                         case 2:
                             odliczanie(round2);
                             break;
                         case 3:
                             odliczanie(round3);
                             break;
                         case 4:
                             odliczanie(round4);
                             break;
                         case 5:
                             odliczanie(round5);
                             break;
                         case 6:
                             odliczanie(round6);
                             break;
                         case 7:
                             odliczanie(round7);
                             break;
                         case 8:
                             odliczanie(round8);
                             break;
    class Licznik extends Thread
        int czas1,k;
        Form forma;
        monitor m;
        public Licznik(int k,Form formap)
            czas1=k;
            forma=formap;
        public synchronized void run()
            while(czas1>0)
                forma.deleteAll();
                forma.append("Czas pozosta&#322;y (s): "+czas1);
                try{Thread.sleep(1000);} catch(InterruptedException e){e.printStackTrace();}
                czas1--;
            if(czas1<=0)
                m.put();
        }and monitor class
    public class monitor
    boolean busy=false;
    synchronized void get()
        if(!busy)
            try
                wait();
            }catch(InterruptedException e){e.printStackTrace();}
        notify();
    synchronized void put()
        if(busy)
            try
            wait();
            }catch(InterruptedException e){e.printStackTrace();}
        busy=true;
        notify();
    }Can anybody help me with this?

    Groovemaker,
    Your Licznik class has a member m of type monitor, which has not been instantiated (in other words is null) hence, when calling m.put() you get NullPointerException. Please also mind, that using Thread.sleep(1000) is not an accurate way of measuring time.
    If I may, please use recommended for Java class naming conventions - some of your names use lower case, while other don't which is confusing to the reader.
    Daniel

  • Problem with threads within applet

    Hello,
    I got an applet, inside this applet I have a singleton, inside this singleton I have a thread.
    this thread is running in endless loop.
    he is doing something and go to sleep on and on.
    the problem is,
    when I refresh my IE6 browser I see more than 1 thread.
    for debug matter, I did the following things:
    inside the thread, sysout every time he goes to sleep.
    sysout in the singleton constructor.
    sysout in the singleton destructor.
    the output goes like this:
    when refresh the page, the singleton constructor loading but not every refresh, sometimes I see the constructor output and sometimes I dont.
    The thread inside the singleton is giving me the same output, sometime I see more than one thread at a time and sometimes I dont.
    The destructor never works (no output there).
    I don't understand what is going on.
    someone can please shed some light?
    thanks.
    btw. I am working with JRE 1.1
    this is very old and big applet and I can't convert it to something new.

    Ooops. sorry!
    I did.
         public void start() {
         public void stop() {
         public void destroy() {
              try {
                   resetAll();
                   Configuration.closeConnection();
                   QuoteItem.closeConnection();
              } finally {
                   try {
                        super.finalize();
                   } catch (Throwable e) {
                        e.printStackTrace();
         }

  • Problem with Threads and a static variable

    I have a problem with the code below. I am yet to make sure that I understand the problem. Correct me if I am wrong please.
    Code functionality:
    A timer calls SetState every second. It sets the state and sets boolean variable "changed" to true. Then notifies a main process thread to check if the state changed to send a message.
    The problem as far I understand is:
    Assume the timer Thread calls SetState twice before the main process Thread runs. As a result, "changed" is set to true twice. However, since the main process is blocked twice during the two calls to SetState, when it runs it would have the two SetState timer threads blocked on its synchronized body. It will pass the first one, send the message and set "changed" to false since it was true. Now, it will pass the second thread, but here is the problem, "changed" is already set to false. As a result, it won't send the message even though it is supposed to.
    Would you please let me know if my understanding is correct? If so, what would you propose to resolve the problem? Should I call wait some other or should I notify in a different way?
    Thanks,
    B.D.
    Code:
    private static volatile boolean bChanged = false;
    private static Thread objMainProcess;
       protected static void Init(){
            objMainProcess = new Thread() {
                public void run() {
                    while( objMainProcess == Thread.currentThread() ) {
                       GetState();
            objMainProcess.setDaemon( true );
            objMainProcess.start();
        public static void initStatusTimer(){
            if(objTimer == null)
                 objTimer = new javax.swing.Timer( 1000, new java.awt.event.ActionListener(){
                    public void actionPerformed( java.awt.event.ActionEvent evt){
                              SetState();
        private static void SetState(){
            if( objMainProcess == null ) return;
            synchronized( objMainProcess ) {
                bChanged = true;
                try{
                    objMainProcess.notify();
                }catch( IllegalMonitorStateException e ) {}
        private static boolean GetState() {
            if( objMainProcess == null ) return false;
            synchronized( objMainProcess ) {
                if( bChanged) {
                    SendMessage();
                    bChanged = false;
                    return true;
                try {
                    objMainProcess.wait();
                }catch( InterruptedException e ) {}
                return false;
        }

    Thanks DrClap for your reply. Everything you said is right. It is not easy to make them alternate since SetState() could be called from different places where the state could be anything else but a status message. Like a GREETING message for example. It is a handshaking message but not a status message.
    Again as you said, There is a reason I can't call sendMessage() inside setState().
    The only way I was able to do it is by having a counter of the number of notifies that have been called. Every time notify() is called a counter is incremented. Now instead of just checking if "changed" flag is true, I also check if notify counter is greater than zero. If both true, I send the message. If "changed" flag is false, I check again if the notify counter is greater than zero, I send the message. This way it works, but it is kind of a patch than a good design fix. I am yet to find a good solution.
    Thanks,
    B.D.

  • Problem with threads running javaw

    Hi,
    Having a problem with multi thread programming using client server sockets. The program works find when starting the the application in a console using java muti.java , but when using javaw multi.java the program doesnt die and have to kill it in the task manager. The program doesnt display any of my gui error messages either when the server disconnect the client. all works find in a console. any advice on this as I havent been able to understand why this is happening? any comment would be appreciated.
    troy.

    troy,
    Try and post a minimum code sample of your app which
    does not work.
    When using javaw, make sure you redirect the standard
    error and standard output streams to file.
    Graeme.Hi Graeme,
    I dont understand what you mean by redirection to file? some of my code below.
    The code works fine under a console, code is supposed to exit when the client (the other server )disconnects. the problem is that but the clientworker side of the code still works. which under console it doesnt.
    public class Server{
    ServerSocket aServerSocket;
    Socket dianosticsSocket;
    Socket nPortExpress;
    ClientListener aClientListener;
    LinkedList queue = new LinkedList();
    int port = 0;
    int clientPort = 0;
    String clientName = null;
    boolean serverAlive = true;
    * Server constructor generates a server
    * Socket and then starts a client threads.
    * @param aPort      socket port of local machine.
    public Server(int aPort, String aClientName, int aClientPort){
    port = aPort;
    clientName = aClientName;
    clientPort = aClientPort;
    try{
    // create a new thread
    aServerSocket = new ServerSocket(port) ;
    // connect to the nPortExpress
    aClientListener = new ClientListener(InetAddress.getByName(clientName), clientPort, queue,this);
    // aClientListener.setDaemon(true);
    aClientListener.start();
    // start a dianostic port
    DiagnosticsServer aDiagnosticsServer = new DiagnosticsServer(port,queue,aClientListener);
    // System.out.println("Server is running on port " + port + "...");
    // System.out.println("Connect to nPort");
    catch(Exception e)
    // System.out.println("ERROR: Server port " + port + " not available");
    JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Server port " + port + " not available", JOptionPane.ERROR_MESSAGE);
    serverAlive = false;
    System.exit(1);
    while(serverAlive&&aClientListener.hostSocket.isConnected()){
    try{
    // connect the client
    Socket aClient = aServerSocket.accept();
    //System.out.println("open client connection");
    //System.out.println("client local: "+ aClient.getLocalAddress().toString());
    // System.out.println("client localport: "+ aClient.getLocalPort());
    // System.out.println("client : "+ aClient.getInetAddress().toString());
    // System.out.println("client port: "+ aClient.getLocalPort());
    // make a new client thread
    ClientWorker clientThread = new ClientWorker(aClient, queue, aClientListener, false);
    // start thread
    clientThread.start();
    catch(Exception e)
    //System.out.println("ERROR: Client connection failure");
    JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Client connection failure", JOptionPane.ERROR_MESSAGE);
    }// end while
    } // end constructor Server
    void serverExit(){
         JOptionPane.showMessageDialog(null, "Server ","ERROR: nPort Failure", JOptionPane.ERROR_MESSAGE);
         System.exit(1);
    }// end class Server
    *** connect to another server
    public class ClientListener extends Thread{
    InetAddress hostName;
    int hostPort;
    Socket hostSocket;
    BufferedReader in;
    PrintWriter out;
    boolean loggedIn;
    LinkedList queue;      // reference to Server queue
    Server serverRef; // reference to main server
    * ClientListener connects to the host server.
    * @param aHostName is the name of the host eg server name or IP address.
    * @param aHostPort is a port number of the host.
    * @param aLoginName is the users login name.
    public ClientListener(InetAddress aHostName, int aHostPort,LinkedList aQueue,Server aServer)      // reference to Server queue)
    hostName = aHostName;
    hostPort = aHostPort;
    queue = aQueue;
    serverRef = aServer;      
    // connect to the server
    try{
    hostSocket = new Socket(hostName, hostPort);
    catch(IOException e){
    //System.out.println("ERROR: Connection Host Failed");
    JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Connection to nPort Failed", JOptionPane.ERROR_MESSAGE);     
    System.exit(0);
    } // end constructor ClientListener
    ** multi client connection server
    ClientWorker(Socket aSocket,LinkedList aQueue, ClientListener aClientListener, boolean diagnostics){
    queue = aQueue;
    addToQueue(this);
    client = aSocket;
    clientRef = aClientListener;
    aDiagnostic = diagnostics;
    } // end constructor ClientWorker
    * run method is the main loop of the server program
    * in change of handle new client connection as well
    * as handle all messages and errors.
    public void run(){
    boolean alive = true;
    String aSubString = "";
    in = null;
    out = null;
    loginName = "";
    loggedIn = false;
    while (alive && client.isConnected()&& clientRef.hostSocket.isConnected()){
    try{
    in = new BufferedReader(new InputStreamReader(client.getInputStream()));
    out = new PrintWriter(new OutputStreamWriter(client.getOutputStream()));
    if(aDiagnostic){
    out.println("WELCOME to diagnostics");
    broadCastDia("Connect : diagnostics "+client.getInetAddress().toString());
    out.flush();
    else {       
    out.println("WELCOME to Troy's Server");
    broadCastDia("Connect : client "+client.getInetAddress().toString());
         out.flush();
    String line;
    while(((line = in.readLine())!= null)){
    StringTokenizer aStringToken = new StringTokenizer(line, " ");
    if(!aDiagnostic){
    broadCastDia(line);
    clientRef.sendMessage(line); // send mesage out to netExpress
    out.println(line);
    out.flush();
    else{
    if(line.equals("GETIPS"))
    getIPs();
    else{
    clientRef.sendMessage(line); // send mesage out to netExpress
    out.println(line);
    out.flush();
    } // end while
    catch(Exception e){
    // System.out.println("ERROR:Client Connection reset");
                             JOptionPane.showMessageDialog(null, (e.toString()),"ERROR:Client Connection reset", JOptionPane.ERROR_MESSAGE);     
    try{
    if(aDiagnostic){
    broadCastDia("Disconnect : diagnostics "+client.getInetAddress().toString());
    out.flush();
    else {       
    broadCastDia("Disconnect : client "+client.getInetAddress().toString());
         out.flush();
    // close the buffers and connection;
    in.close();
    out.close();
    client.close();
    // System.out.println("out");
    // remove from list
    removeThreadQueue(this);
    alive = false;
    catch(Exception e){
    // System.out.println("ERROR: Client Connection reset failure");
    JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Client Connection reset failure", JOptionPane.ERROR_MESSAGE);     
    }// end while
    } // end method run
    * method run - Generates io stream for communicating with the server and
    * starts the client gui. Run also parses the input commands from the server.
    public void run(){
    boolean alive = true;
    try{
    // begin to life the gui
    // aGuiClient = new ClientGui(hostName.getHostName(), hostPort, loginName, this);
    // aGuiClient.show();
    in = new BufferedReader(new InputStreamReader(hostSocket.getInputStream()));
    out = new PrintWriter(new OutputStreamWriter(hostSocket.getOutputStream()));
    while (alive && hostSocket.isConnected()){
    String line;
    while(((line = in.readLine())!= null)){
    System.out.println(line);
    broadCast(line);
    } // end while
    } // end while
    catch(Exception e){
    //     System.out.println("ERRORa Connection to host reset");
    JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Connection to nPort reset", JOptionPane.ERROR_MESSAGE);
    try{
    hostSocket.close();
         }catch(Exception a){
         JOptionPane.showMessageDialog(null, (a.toString()),"ERROR: Exception", JOptionPane.ERROR_MESSAGE);
    alive = false;
    System.exit(1);
    } // end method run

Maybe you are looking for

  • Itunes unknown error (-69)

    I have a ipod shuffle connected to itunes 7.0.1 (windows xp). I can copy a number of songs on it, however after it is filled a little bit, i get more and more the message "unbekannter fehler (-69)" (in German, which is probably "unknown error (-69)"

  • Comparing data size in one table to column widths in another table

    I have data in a table that has a large number of columns, many of them nvarchar of varying widths.  Im trying to take that data and insert it into another table but Im getting the warning message about string or binary data being truncated.  I suspe

  • Error when migrating AP 2600 from Autonomous to Lightweight

    Hello, I am trying to migrating AP 2600 series that came with autonomous image 15.2 to lightweight using the Cisco Prime Infrastructure built-in migration template. The AP successfully downloads the image from an external TFTP server but fails at upd

  • Batch export to network drive fails on large clips

    SO I have dozens of clips to batch export in full quality uncoompressed format. THey come out anywhere from 1-10 gigs per file. When I export to a desktop drive everything works great, when I do the same batch export to a network attached storage dri

  • Book reader setup on 4.0 tablet?

    How do I authorize my tablet for library book downloag like I did on my desktop?