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:
- Create a new empty project in Visual J++ 6.0.
- Add an empty class to the project. Name it CabApplet1 and place it in a Java package called basecab.
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(); } } }
- 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.)
- Create another new empty project in Visual J++ 6.0 and add it to the current solution.
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."); } }
- Follow the same procedure provided in step 4, but set the Friendly name to DependCab and the file name to Cab2.cab.
- 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. - 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
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