001/*
002 * IzPack - Copyright 2001-2005 Julien Ponge, All Rights Reserved.
003 * 
004 * http://www.izforge.com/izpack/
005 * http://developer.berlios.de/projects/izpack/
006 * 
007 * Copyright 2003 Jonathan Halliday
008 * 
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *     http://www.apache.org/licenses/LICENSE-2.0
014 *     
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 */
021
022package com.izforge.izpack.installer;
023
024import java.util.Date;
025
026import com.izforge.izpack.util.Debug;
027import com.izforge.izpack.util.StringTool;
028
029/**
030 * The program entry point. Selects between GUI and text install modes.
031 * 
032 * @author Jonathan Halliday
033 */
034public class Installer
035{
036
037    /**
038     * The main method (program entry point).
039     * 
040     * @param args The arguments passed on the command-line.
041     */
042    public static void main(String[] args)
043    {
044        Debug.log(" - Logger initialized at '"+ new Date( System.currentTimeMillis() )+ "'.");
045        
046        Debug.log(" - commandline args: " + StringTool.stringArrayToSpaceSeparatedString(args) );
047        
048        // OS X tweakings
049        if (System.getProperty("mrj.version") != null)
050        {
051            System.setProperty("com.apple.mrj.application.apple.menu.about.name", "IzPack");
052            System.setProperty("com.apple.mrj.application.growbox.intrudes", "false");
053            System.setProperty("com.apple.mrj.application.live-resize", "true");
054        }
055
056        try
057        {
058            if (args.length == 0)
059            {
060                // can't load the GUIInstaller class on headless machines,
061                // so we use Class.forName to force lazy loading.
062                Class.forName("com.izforge.izpack.installer.GUIInstaller").newInstance();
063            }
064            else
065            {
066                new AutomatedInstaller(args[0]);
067            }
068        }
069        catch (Exception e)
070        {
071            System.err.println("- Error -");
072            System.err.println(e.toString());
073            e.printStackTrace();
074            System.exit(0);
075        }
076    }
077
078    
079}