01: // This file is part of KeY - Integrated Deductive Software Design
02: // Copyright (C) 2001-2007 Universitaet Karlsruhe, Germany
03: // Universitaet Koblenz-Landau, Germany
04: // Chalmers University of Technology, Sweden
05: //
06: // The KeY system is protected by the GNU General Public License.
07: // See LICENSE.TXT for details.
08: //
09: //
10: package de.uka.ilkd.key.util.install;
11:
12: import java.awt.GraphicsEnvironment;
13: import java.io.File;
14:
15: import javax.swing.JFrame;
16:
17: public class Installer extends JFrame {
18:
19: public static void main(String[] args) {
20: String os = System.getProperty("os.name");
21: String currentDir = System.getProperty("user.dir");
22: String defaultKeYHome = System.getProperty("user.home")
23: + File.separatorChar;
24: defaultKeYHome = (defaultKeYHome == null ? "" : defaultKeYHome)
25: + "KeY" + File.separator;
26: String defaultKeYLib = defaultKeYHome + "key-ext-jars";
27: String javaHome = System.getProperty("java.home");
28:
29: if (javaHome.endsWith("jre"))
30: javaHome = javaHome.substring(0, javaHome
31: .lastIndexOf("jre"));
32:
33: if (os.toLowerCase().indexOf("mac") != -1) {
34: if (javaHome.endsWith("Home"))
35: javaHome = javaHome.substring(0, javaHome
36: .lastIndexOf("Home"));
37: }
38:
39: System.out.println(" Current :" + currentDir);
40: System.out.println(" KeYHome :" + defaultKeYHome);
41: System.out.println(" KeYLib :" + defaultKeYLib);
42: System.out.println(" java.home :" + javaHome);
43: System.out.println(" OS :" + os);
44:
45: boolean gui = true;
46:
47: if (args.length > 0 && "--text".equals(args[0])) {
48: gui = false;
49: } else {
50: try {
51: if (GraphicsEnvironment.getLocalGraphicsEnvironment()
52: .getScreenDevices() == null
53: || GraphicsEnvironment
54: .getLocalGraphicsEnvironment()
55: .getScreenDevices().length == 0) {
56: gui = false;
57: }
58: } catch (Throwable err) {
59: gui = false;
60: }
61: }
62:
63: if (gui) {
64: new KeYInstallerGUI(defaultKeYHome, defaultKeYLib,
65: javaHome, currentDir, os).start();
66: } else {
67: new KeYInstallerCmdLine(defaultKeYHome, defaultKeYLib,
68: javaHome, currentDir, os).start();
69: }
70: }
71:
72: }
|