示例#1
0
  public static final void main(String[] args) {
    try {

      /**
       * We use log4j as our logging implementation as it rules but lets not fail if it aint around
       * so we !
       */
      if (System.getProperty("log4j.properties") != null) {

        try {
          Properties properties = new Properties();
          properties.load(ConfigurationLoader.loadFile(System.getProperty("log4j.properties")));

          try {
            Class cls = Class.forName("org.apache.log4j.PropertyConfigurator");
            Object obj = cls.newInstance();
            Method method = cls.getMethod("configure", new Class[] {Properties.class});
            method.invoke(obj, new Object[] {properties});
            System.out.println(System.getProperty("log4j.properties"));
          } catch (Throwable ex) {
          }
        } catch (IOException ex) {
          configureBasicLogging();
        }
      } else {
        configureBasicLogging();
      }

      XmlConfigurationContext context = new XmlConfigurationContext();

      context.setAutomationConfigurationResource("automation.xml");
      context.setFailOnError(false);

      ConfigurationLoader.initialize(false, context);

      SshTerm term = new SshTerm();

      term.init(args);
      term.newContainer();
    } catch (Exception e) {
      e.printStackTrace();
      JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
      System.exit(0);
    }
  }