KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > launch4j > Main


1 /*
2     Launch4j (http://launch4j.sourceforge.net/)
3     Cross-platform Java application wrapper for creating Windows native executables.
4
5     Copyright (C) 2004, 2006 Grzegorz Kowal
6
7     This program is free software; you can redistribute it and/or modify
8     it under the terms of the GNU General Public License as published by
9     the Free Software Foundation; either version 2 of the License, or
10     (at your option) any later version.
11
12     This program is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     GNU General Public License for more details.
16
17     You should have received a copy of the GNU General Public License
18     along with this program; if not, write to the Free Software
19     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */

21
22 /*
23  * Created on Apr 21, 2005
24  */

25 package net.sf.launch4j;
26
27 import java.io.File JavaDoc;
28 import java.io.InputStream JavaDoc;
29 import java.util.Properties JavaDoc;
30
31 import net.sf.launch4j.config.ConfigPersister;
32 import net.sf.launch4j.formimpl.MainFrame;
33
34 /**
35  * @author Copyright (C) 2005 Grzegorz Kowal
36  */

37 public class Main {
38     private static String JavaDoc _name;
39     private static String JavaDoc _description;
40
41     public static void main(String JavaDoc[] args) {
42         try {
43             Properties JavaDoc props = new Properties JavaDoc();
44             InputStream JavaDoc in = Main.class.getClassLoader()
45                     .getResourceAsStream("launch4j.properties");
46             props.load(in);
47             in.close();
48             setDescription(props);
49
50             if (args.length == 0) {
51                 ConfigPersister.getInstance().createBlank();
52                 MainFrame.createInstance();
53             } else if (args.length == 1 && !args[0].startsWith("-")) {
54                 ConfigPersister.getInstance().load(new File JavaDoc(args[0]));
55                 Builder b = new Builder(Log.getConsoleLog());
56                 b.build();
57             } else {
58                 System.out.println(_description
59                         + Messages.getString("Main.usage")
60                         + ": launch4j config.xml");
61             }
62         } catch (Exception JavaDoc e) {
63             Log.getConsoleLog().append(e.getMessage());
64         }
65     }
66
67     public static String JavaDoc getName() {
68         return _name;
69     }
70
71     public static String JavaDoc getDescription() {
72         return _description;
73     }
74
75     private static void setDescription(Properties JavaDoc props) {
76         _name = "Launch4j " + props.getProperty("version");
77         _description = _name +
78                 " (http://launch4j.sourceforge.net/)\n" +
79                 "Cross-platform Java application wrapper" +
80                         " for creating Windows native executables.\n\n" +
81                 "Copyright (C) 2004, 2006 Grzegorz Kowal\n\n" +
82                 "Launch4j comes with ABSOLUTELY NO WARRANTY.\n" +
83                 "This is free software, licensed under the GNU General Public License.\n" +
84                 "This product includes software developed by the Apache Software Foundation" +
85                         " (http://www.apache.org/).\n\n";
86     }
87 }
88
Popular Tags