KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > izforge > izpack > installer > Installer


1 /*
2  * IzPack - Copyright 2001-2007 Julien Ponge, All Rights Reserved.
3  *
4  * http://www.izforge.com/izpack/
5  * http://developer.berlios.de/projects/izpack/
6  *
7  * Copyright 2003 Jonathan Halliday
8  *
9  * 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 JavaDoc;
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     /**
38      * The main method (program entry point).
39      *
40      * @param args The arguments passed on the command-line.
41      */

42     public static void main(String JavaDoc[] args)
43     {
44         Debug.log(" - Logger initialized at '"+ new Date JavaDoc( System.currentTimeMillis() )+ "'.");
45         
46         Debug.log(" - commandline args: " + StringTool.stringArrayToSpaceSeparatedString(args) );
47         
48         // OS X tweakings
49
if (System.getProperty("mrj.version") != null)
50         {
51             System.setProperty("com.apple.mrj.application.apple.menu.about.name", "IzPack");
52             System.setProperty("com.apple.mrj.application.growbox.intrudes", "false");
53             System.setProperty("com.apple.mrj.application.live-resize", "true");
54         }
55
56         try
57         {
58             if (args.length == 0)
59             {
60                 // can't load the GUIInstaller class on headless machines,
61
// so we use Class.forName to force lazy loading.
62
Class.forName("com.izforge.izpack.installer.GUIInstaller").newInstance();
63             }
64             else
65             {
66                 AutomatedInstaller ai = new AutomatedInstaller(args[0]);
67                 // this method will also exit!
68
ai.doInstall();
69             }
70         }
71         catch (Exception JavaDoc e)
72         {
73             System.err.println("- ERROR -");
74             System.err.println(e.toString());
75             e.printStackTrace();
76             System.exit(1);
77         }
78     }
79
80 }
81
Popular Tags