1 2 Previous Next 27 Replies Latest reply on May 21, 2004 5:36 PM by 800382 Go to original post
      • 15. Re: Applets and Plug-ins
        800382
        Codebase has 2 meanings:
        1) As an attribute for the OBJECT tag, it's the place for IE to get the installer for the plugin or ActiveX control. This has nothing to do with the applet running, or lack thereof.
        2) As an attribute for the Java plugin, it's the base directory, relative to the web page's location, where all the applet contents are. Now, it is my understanding that codebase and archive are not related. Meaning, I don't believe the plugin does this:

        URL codebase = new URL(getCodebase());// however it gets that...
        URL archive = new URL(codebase, getArchive()); // presuming only one archive item for the sake of an example...

        I thought it does this:
        URL archive = new URL(getArchive()); // presuming only one archive item for the sake of an example...

        So if it did the former, then I could see path issues. But I think codebase is just used to resolve URLs for classes not found in the archive jars. Anyway, you should put a codebase attribute for EMBED as well.

        <EMBED type = "application/x-java-applet;version=1.4"
        CODE = "st.Applet1.class"
        CODEBASE="."
        ARCHIVE = "web/Applet1.jar,web/jdom.jar,web/graphics.jar"


        The error was this: java.util.zip.ZipException: duplicate entry: META-INF/
        So that's confusing me, cuz I've never seen that. It should resolve jars separately. I've used multiple archive jars with 1.3 and 1.4 without issue.
        • 16. Re: Applets and Plug-ins
          807595
          Can you post a simple html example from 1.3 or 1.4 that uses multiple Jars?
          Maybe i need something special in the Applet1.jar Manifest. I think it has almost
          nothing in it. It's generated by JBuilder as:

          Manifest-Version: 1.0
          • 17. Re: Applets and Plug-ins
            807595
            I have had similar unexplained problems with Applets and html.
            I see that you are using a number of Jar files, and I wonder if maybe the
            Manifests aren't conflicting, as in maybe each declaring a different
            Plug-in version?

            I actually don't know if this would cause conflicts or not, but what if one
            is built with a 1.4.2 and you are only working with 1.4.0. Can anyone
            comment on how the Manifest is used? Could this be a source of
            inCleveland's problems?
            • 18. Re: Applets and Plug-ins
              800382
              If the manifest is the default created by the Jar program and the IDE isn't explicitly creating one, it should simply have "Manifest-Version: 1.0" and a "Created-By: " line. If you open the Jar file in WinZip or type "jar -tf thejar.jar" it'll list the contents. If that fails, then there is a corrupted jar and I would suspect the IDE is mucking something up somehow. If it really has 2 manifest files or META-INF directories listed, that's a problem too. But if the Jars are separate Jars, the META-INF and manifest files should not conflict.

              As for a sample HTML, this is from the project I'm working with now. It's in JSP, so I have some variables defined for common things, but still. Actually, I was wrong with what I said before. The codebase is used to resolve the archive jars. It must be, otherwise my applet (which does work fine) wouldn't work with this HTML...
              // Java plug-in 1.4...
              String pluginType = "application/x-java-applet;version=1.4";
              String pluginRoot = "http://java.sun.com/products/plugin";
              String iePlugin = pluginRoot + "/autodl/jinstall-1_4-windows-i586.cab#Version=1,4,1,mn";
              String nsPlugin = pluginRoot;
              
              // Basic parameters
              String appletName = "TreeServlet";
              String codeBase = "applets/";
              String baseJars = "./TreeApplet.jar, ./lib/pushletclient.jar";
              String mainClass = "DomainTreeApplet.class";
              int width = 200;
              int height = Integer.parseInt(application.getInitParameter("height"), 10)-175;
              
              // Applet parameters
              String bgcolor = "#ffffff";
              String pushlet = "pushlet?client=java&subject=/webems";
              String servlet = "tree_loader.jsp";
              String userId = Long.toString(us.getSessionKey());
              String sessionId = session.getId();
              String linkTarget = "main";
              String typeUrls = ""
              String uniqueId = "q";
              %>
              
              <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
                        id="<%= appletName %>" name="<%= appletName %>"  
                        codebase="<%= iePlugin %>"
                        width="<%= width %>" height="<%= height %>" 
                        align="top" vspace="0" hspace="0">
                   <param name="type" value="<%= pluginType %>" />
                   <param name="codebase" value="<%= codeBase %>" />
                   <param name="archive" value="<%= baseJars %>" />
                   <param name="code" value="<%= mainClass %>" />
                   <param name="mayscript" value="true" />
                   <param name="scriptable" value="true">
                   <param name="alt" 
                        value="Please enable Java Applets or use a browser which supports them." />
              
                   <param name="browser" value="ie">
                   <param name="background" value="<%= bgcolor %>">
                   <param name="pushlet" value="<%= pushlet %>" />
                   <param name="servlet" value="<%= servlet %>" />
                   <param name="user_id" value="<%= userId %>" />
                   <param name="session_id" value="<%= sessionId %>" />
                   <param name="type_urls" value="<%= typeUrls %>" />
                   <param name="target" value="<%= linkTarget %>" />
                   <param name="unique_id" value="<%= uniqueId %>" />
              
              <comment>
              <embed id="<%= appletName %>" name="<%= appletName %>" 
                   pluginspage="<%= nsPlugin %>" 
                   width="<%= width %>" height="<%= height %>" 
                   align="top" vspace="0" hspace="0" 
                   type="<%= pluginType %>" 
                   codebase="<%= codeBase %>" 
                   archive="<%= baseJars %>" 
                   code="<%= mainClass %>" 
                   mayscript="true" 
                   scriptable="true" 
                   alt="Please enable Java Applets or use a browser which supports them." 
              
                   browser="ns"
                   background="<%= bgcolor %>" 
                   pushlet="<%= pushlet %>" 
                   servlet="<%= servlet %>" 
                   user_id="<%= userId %>" 
                   session_id="<%= sessionId %>" 
                   type_urls="<%= typeUrls %>" 
                   target="<%= linkTarget %>" 
                   unique_id="<%= uniqueId %>" 
                   />
              </comment>
              
              </object>
              • 19. Re: Applets and Plug-ins
                807595
                Maybe i need something special in the Applet1.jar
                Manifest. I think it has almost
                nothing in it. It's generated by JBuilder as:

                Manifest-Version: 1.0
                If you have a jar that references other jars, you may have to add them to the Class-Path attribute in the manifest:

                Class-Path: foo.jar bar.jar

                You've probably already told JBuilder where to find the jars, so it's not an issue when you run it from there.
                • 20. Re: Applets and Plug-ins
                  807595
                  I just tried your suggestion but it didn't make any difference. Still got the same errors.
                  • 21. Re: Applets and Plug-ins
                    800382
                    what's the manifest file say? Or did you try verifying what's in the Jars?
                    • 22. Re: Applets and Plug-ins
                      807595
                      I modified the manifest of the main class to see if the previous suggestion made any difference and it didn't.

                      Here it is:

                      Manifest-Version: 1.0
                      Class-Path: gnujaxp.jar jdom.jar

                      Previously it was just line 1.
                      • 23. Re: Applets and Plug-ins
                        807595
                        I modified the manifest of the main class to see if
                        the previous suggestion made any difference and it
                        didn't.

                        Here it is:

                        Manifest-Version: 1.0
                        Class-Path: gnujaxp.jar jdom.jar

                        Previously it was just line 1.
                        Try:

                        Manifest-Version: 1.0
                        Class-Path: .;gnujaxp.jar;jdom.jar;


                        Make sure you have a blank line at the end of the file. So after the last semicolon hit enter, then save.

                        • 24. Re: Applets and Plug-ins
                          807595
                          I found a solution to the problem, though I'd rather have a more flexible one.

                          I think the source of the problem is using plug-in 1.4 AND refering to gnujaxp.jar.
                          The plug-in has its own SaxBuilder and there seems to be some conflict causing
                          the exception due to referring to another jar with a SaxBuilder.
                          The problem disappears if I build with 1.4 and remove gnujaxp.jar. One would think
                          that this wouldn't cause an exception.

                          The downside is I am stuck with this scenario and I only have Jbuilder that supports
                          1.3. Guess I have to move to NetBeans. I wonder if forcing plug-in 1.3 instead would remove the
                          problem too?
                          Thanks you for all of your suggestions!
                          • 25. Re: Applets and Plug-ins
                            800382
                            I don't know... When I have multiple Jar files in the archive, I have no Class-Path: line in the manifests for any of them. Just listing them in the archive attribute is enough.
                            • 26. Re: Applets and Plug-ins
                              807595
                              I just don't get it. I had to upgrade my source and build using 1.4 because I tried to go
                              back and use 1.3 and added gnujaxp back in. I got the same $%%(*)*+) warning.

                              And I don't know what happened, when I build using 1.4 and the 1.4 plug-in, the warning
                              has returned.

                              I am baffled.
                              • 27. Re: Applets and Plug-ins
                                800382
                                try using separate jars and not having the Class Path line in the manifest files... that's all I can think of that sounds different from what seem to have and what I have.
                                1 2 Previous Next