KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jdesktop > jdic > packager > Jnlp2Msi


1 /*
2  * Copyright (C) 2004 Sun Microsystems, Inc. All rights reserved. Use is
3  * subject to license terms.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the Lesser GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of the
8  * License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA.
19  */

20
21 package org.jdesktop.jdic.packager;
22
23 import java.io.IOException JavaDoc;
24 import org.jdesktop.jdic.packager.impl.Jnlp2Package;
25 import org.jdesktop.jdic.packager.impl.JnlpConstants;
26 import org.jdesktop.jdic.packager.impl.JnlpUtility;
27
28
29 /**
30  * Command line entry point into JDIC Packager to package a JNLP application
31  * into a MSI package. This class is entered via the canonical `public static
32  * void main` entry point and reads the command line arguments.
33  *
34  * <pre>
35  * The command line to use this class is:
36  * java [property options] &lt;-DMSSDKDir=&lt;value&gt;&gt; org.jdesktop.jdic.packager.Jnlp2Msi &lt;JNLP file path&gt;
37  *
38  * &lt;JNLP file path&gt;: the path of the JNLP file.
39  * [property options] include:
40  * -DResourceDir=&lt;value&gt;: set the directory of the JNLP resource files.
41  * The default value is the parent path of the given JNLP file.
42  * -DLicenseDir=&lt;value&gt;: set the directory of the license files if available.
43  * -DPackageName=&lt;value&gt;: set the name of the generated MSI package.
44  * The default value is the jnlp file name without extension.
45  * -DOutputDir=&lt;value&gt;: set the directory where the generated MSI package
46  * is put. The default value is the current directory.
47  * -DVersion=&lt;value&gt;: set the version number of the generated package.
48  * The default value is 1.0.
49  * -DRelease=&lt;value&gt;: set the release number of the generated package,
50  * The default value is 1.
51  * -DEnableShortcut=&lt;true|false&gt;: if true, create shortcut on the desktop after
52  * the generated package is installed; if false, no shortcut will be created.
53  * The default value is false.
54  * -DEnableAssociation=&lt;true|false&gt;: if true, associate the file extension .jnlp with
55  * Java Web Start executable after the generated package is installed; if false, no
56  * association will be created. The default value is false.
57  * -DEnableSystemCache=&lt;true|false&gt;: if true, install the JNLP application into
58  * the system cache of Java Web Start; if false, it's installed in the user cache.
59  * The default value is false.
60  * -DBannerJpgFile=&lt;value&gt;: set the path of the banner picture which will be used in
61  * the Windows MSI installation GUI. If not specified, a default jpeg file contained in
62  * the jar file will be used.
63  * -DPanelJpgFile=&lt;value&gt;: set the path of the panel picture which will be used in
64  * the Windows MSI installation GUI. If not specified, a default jpeg file contained in
65  * the jar file will be used.
66  * &lt;-DMSSDKDir=&lt;value&gt;&gt;: set the directory where Windows SDK Update gets installed.
67  * </pre>
68  * <p>
69  * While the end-user installs the generated package, Java Web Start executable (javaws)
70  * will run to install the JNLP application to the system or user cache of Java Web Start.
71  * It will then be displayed in the "Application Manager" dialog of Java Web Start.
72  * <p>
73  * While the end-user uninstalls the installed package, javaws will run to remove the JNLP
74  * application from the system or user cache, as well as the "Application Manager"
75  * dialog of Java Web Start.
76  *
77  * @see Jnlp2Rpm
78  * @see Jnlp2Pkg
79  */

80 public class Jnlp2Msi {
81     /**
82      * Command line entry point. This method starts generating a MSI package
83      * using the given JNLP application and specified properties.
84      *
85      * @param args command line arguments.
86      */

87     public static void main(final String JavaDoc[] args) {
88         // Check if this class/tool could be used on the platform.
89
JnlpUtility.checkPlatformCompatibility(JnlpConstants.OS_WINDOWS);
90
91         // Generate an installable package.
92
try {
93             Jnlp2Package.generatePackage(args);
94         } catch (IOException JavaDoc e1) {
95             System.out.println(e1.getMessage());
96         } catch (IllegalArgumentException JavaDoc e2) {
97             System.out.println(e2.getMessage());
98         } catch (Exception JavaDoc e) {
99             e.printStackTrace();
100         } catch (Error JavaDoc err) {
101             err.printStackTrace();
102         } finally {
103             System.exit(0);
104         }
105     }
106 }
107
Popular Tags