01: /*
02: * IzPack - Copyright 2001-2008 Julien Ponge, All Rights Reserved.
03: *
04: * http://izpack.org/
05: * http://izpack.codehaus.org/
06: *
07: * Copyright 2003 Jonathan Halliday
08: *
09: * Licensed under the Apache License, Version 2.0 (the "License");
10: * you may not use this file except in compliance with the License.
11: * You may obtain a copy of the License at
12: *
13: * http://www.apache.org/licenses/LICENSE-2.0
14: *
15: * Unless required by applicable law or agreed to in writing, software
16: * distributed under the License is distributed on an "AS IS" BASIS,
17: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18: * See the License for the specific language governing permissions and
19: * limitations under the License.
20: */
21:
22: package com.izforge.izpack.installer;
23:
24: import java.util.Date;
25:
26: import com.izforge.izpack.util.Debug;
27: import com.izforge.izpack.util.StringTool;
28:
29: /**
30: * The program entry point. Selects between GUI and text install modes.
31: *
32: * @author Jonathan Halliday
33: */
34: public class Installer {
35:
36: /**
37: * The main method (program entry point).
38: *
39: * @param args The arguments passed on the command-line.
40: */
41: public static void main(String[] args) {
42: Debug.log(" - Logger initialized at '"
43: + new Date(System.currentTimeMillis()) + "'.");
44:
45: Debug.log(" - commandline args: "
46: + StringTool.stringArrayToSpaceSeparatedString(args));
47:
48: // OS X tweakings
49: if (System.getProperty("mrj.version") != null) {
50: System.setProperty(
51: "com.apple.mrj.application.apple.menu.about.name",
52: "IzPack");
53: System.setProperty(
54: "com.apple.mrj.application.growbox.intrudes",
55: "false");
56: System.setProperty("com.apple.mrj.application.live-resize",
57: "true");
58: }
59:
60: try {
61: if (args.length == 0) {
62: // can't load the GUIInstaller class on headless machines,
63: // so we use Class.forName to force lazy loading.
64: Class.forName(
65: "com.izforge.izpack.installer.GUIInstaller")
66: .newInstance();
67: } else {
68: AutomatedInstaller ai = new AutomatedInstaller(args[0]);
69: // this method will also exit!
70: ai.doInstall();
71: }
72: } catch (Exception e) {
73: System.err.println("- ERROR -");
74: System.err.println(e.toString());
75: e.printStackTrace();
76: System.exit(1);
77: }
78: }
79:
80: }
|