Microsoft KB Archive/246492

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 13:50, 21 July 2020 by X010 (talk | contribs) (Text replacement - """ to """)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Base


How To Use Visual J++ 6.0 to Make Dependency Distribution Units

Article ID: 246492

Article Last Modified on 6/14/2006



APPLIES TO

  • Microsoft Visual J++ 6.0 Standard Edition



This article was previously published under Q246492

SUMMARY

This article describes how you can use the Visual J++ 6.0 IDE to add dependencies to distribution units (DU). It includes sample code that you can use to test a simple DU dependency.

MORE INFORMATION

Use this procedure to add dependencies to DUs:

  1. Create a new empty project in Visual J++ 6.0.
  2. Add an empty class to the project. Name it CabApplet1 and place it in a Java package called basecab.
  3. Edit the CabApplet1.java file so that it contains the following Java code section. Note that at this stage, you cannot build the Java source file because the class that you need from the dependcab package does not yet exist.

    package basecab;
    
    import java.applet.*;
    import dependcab.*;
    
    public class CabApplet1 extends Applet { 
      public void init() { 
        try { 
          add(new java.awt.Label("This is the applet."));
          NeededClass nc = new NeededClass();
          nc.testMethod();
        } catch (Exception ex) { 
          ex.printStackTrace();
        }
      }
    }
                        
  4. From the Project menu, select Properties. On the Output Format tab, select Enable Packaging. From the Packaging Type drop-down list, select Cabinet Archive. Set the cabinet file name to be cab1.cab and include only the Basecab\CabApplet1.class in the cabinet. Next, click Advanced, and then set the Friendly name to BaseCab and the version to 1,1,1,1. (Note that you will be signing the cab files with a test certificate, which is the default setting when the output format is a cabinet file.)
  5. Create another new empty project in Visual J++ 6.0 and add it to the current solution.
  6. Add a new empty class to the project and call it NeededClass. Place the new class in a package called dependcab and edit the source to contain the following code segment.

    package dependcab;
    
    public class NeededClass { 
      public void testMethod() { 
        System.out.println("testMethod() called.");
      }
    }
                        
  7. Follow the same procedure provided in step 4, but set the Friendly name to DependCab and the file name to Cab2.cab.
  8. Next, build the second project (Dependcab\NeededClass), and then build the first project (Basecab\CabApplet1).

    At this point, you have two projects, both packaged in signed cabinet files and using the Open Software Description (OSD) XML-based manifest.
  9. The final step is to add the output of the second project as a dependency to the .osd file in the cabinet of the first project. Thankfully, Visual J++ does most of the work for you because the application is generating the OSD files when you build the projects. (For more information on how to do this without the help of Visual J++, see the "References" section of this article). From the Project menu, select Properties. On the Output Format tab, click Advanced, select the External Dependencies tab, and then click Add. Next, type the URL, Friendly name, and version of the cabinet file output of the second project:

    http://mywebserver/cab2.cab
    DependCab
    1,1,1,1

    Note that only an absolute URL will work here, so you must actually deploy your project output to a Web server to test this. For more information on the absolute URL limitation, see "References."

HTML test file:

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>

<APPLET
    code="basecab.CabApplet1"
    name="CabApplet1"
    width=320
    height=200  VIEWASTEXT>

<PARAM NAME="useslibrary" VALUE="BaseCab">
<PARAM NAME="useslibrarycodebase" VALUE="cab1.cab">
<PARAM NAME="useslibraryversion" VALUE="1,1,1,1">
</APPLET>

</BODY>
</HTML>
                



The third-party products that are discussed in this article are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.


REFERENCES

For additional information about relative URLs and distribution unit dependencies, click the article number below to view the article in the Microsoft Knowledge Base:

247369 FIX: Relative URLs Don't Work For Distribution Unit Dependencies


For additional information on how to package distribution unit dependencies without the help of Visual J++, click the article number below to view the article in the Microsoft Knowledge Base:

242970 How To Implement Dependencies When Building Distribution Units Manually


For support information about Visual J++ and the SDK for Java, visit the following Microsoft Web site:

Keywords: kbhowto kbdownload kbide kbcab kbcode KB246492