KickJava   Java API By Example, From Geeks To Geeks.

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


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 PKG package. This class is entered via the canonical `public static
32  * void main` entry point and reads the command line arguments.
33  * <p>
34  * The generated installable package is in directory structure format. It
35  * could be installed as input to the "pkgadd" command.
36  *
37  * <pre>
38  * The command line to use this class is:
39  * java [property options] org.jdesktop.jdic.packager.Jnlp2Pkg &lt;JNLP file path&gt;
40  *
41  * &lt;JNLP file path&gt;: the path of the JNLP file.
42  * [property options] include:
43  * -DResourceDir=&lt;value&gt;: set the directory of the JNLP resource files.
44  * The default value is the parent path of the given JNLP file.
45  * -DLicenseDir=&lt;value&gt;: set the directory of the license files if available.
46  * -DPackageName=&lt;value&gt;: set the name of the generated PKG package.
47  * The default value is the jnlp file name without extension.
48  * -DOutputDir=&lt;value&gt;: set the directory where the generated PKG package
49  * is put. The default value is the current directory.
50  * -DVersion=&lt;value&gt;: set the version number of the generated package.
51  * The default value is 1.0.
52  * -DRelease=&lt;value&gt;: set the release number of the generated package,
53  * The default value is 1.
54  * -DEnableShortcut=&lt;true|false&gt;: if true, create shortcut on the desktop after
55  * the generated package is installed; if false, no shortcut will be created.
56  * The default value is false.
57  * -DEnableAssociation=&lt;true|false&gt;: if true, associate the file extension .jnlp with
58  * Java Web Start executable after the generated package is installed; if false, no
59  * association will be created. The default value is false.
60  * -DEnableSystemCache=&lt;true|false&gt;: if true, install the JNLP application into
61  * the system cache of Java Web Start; if false, it's installed in the user cache.
62  * The default value is false.
63  * </pre>
64  * <p>
65  * While the end-user installs the generated package, Java Web Start executable (javaws)
66  * will run to install the JNLP application to the system or user cache of Java Web Start.
67  * It will then be displayed in the "Application Manager" dialog of Java Web Start.
68  * <p>
69  * While the end-user uninstalls the installed package, javaws will run to remove the JNLP
70  * application from the system or user cache, as well as the "Application Manager"
71  * dialog of Java Web Start.
72  *
73  * @see Jnlp2Msi
74  * @see Jnlp2Rpm
75  */

76 public class Jnlp2Pkg {
77     /**
78      * Command line entry point. This method starts generating a PKG package
79      * using the given JNLP application and specified properties.
80      *
81      * @param args command line arguments.
82      */

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