Example usage for java.lang Throwable printStackTrace

List of usage examples for java.lang Throwable printStackTrace

Introduction

In this page you can find the example usage for java.lang Throwable printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:it.cnr.icar.eric.client.xml.registry.jaas.LoginModuleManager.java

/**
 * @param args the command line arguments
 *//*from  ww w. jav a2 s  .  c  o m*/
public static void main(String[] args) {
    for (int i = 0; i < args.length; i++) {
        try {
            String argFlag = args[i];

            if (argFlag.equals("-d")) {
                createDefaultLoginFile = true;
            } else if (argFlag.equals("-l")) {
                createLoginFile = true;
            } else if (argFlag.equals("-c")) {
                getCallbackHandler = true;
            } else { // if no flags execute all methods
                createDefaultLoginFile = true;
                createLoginFile = true;
                getCallbackHandler = true;
            }
        } catch (RuntimeException ex) {
            // use defaults
            continue;
        }
    }

    if (args.length == 0) {
        createLoginFile = true;
    }

    LoginModuleManager loginModuleMgr = new LoginModuleManager();

    try {
        if (createDefaultLoginFile) {
            log.info(
                    JAXRResourceBundle.getInstance().getString("message.startingCreateDefaultLoginConfigFile"));
            loginModuleMgr.createDefaultLoginConfigFile();
        }

        if (createLoginFile) {
            log.info(JAXRResourceBundle.getInstance().getString("message.startingCreateLoginConfigFile"));
            loginModuleMgr.createLoginConfigFile();
        }

        if (getCallbackHandler) {
            log.info(JAXRResourceBundle.getInstance().getString("message.startingGetCallbackHandler"));
            loginModuleMgr.getCallbackHandler();
        }
    } catch (Throwable t) {
        t.printStackTrace();
    }
}

From source file:com.yobidrive.diskmap.DiskMapManager.java

public static void main(String[] args) {

    try {//from ww  w  . j  av  a  2  s  .co  m
        BasicConfigurator.configure();
        //   (String storeName, String logPath, String keyPath, long ckeckPointPeriod, long logSize, int keySize,
        //      long mapSize, int packInterval, int readThreads, long needleCachedEntries, long bucketCachedBytes, short nodeId)

        /* String path = "/Users/david/Documents/NEEDLES";
        if ( args.length > 0) {
           path = args[0];
        }
        System.out.println("Using directory:" + path);
        */
        DiskMapManager dmm = new DiskMapManager("TestStore", "/drive_hd1", "/drive_ssd/storage_indexes", 1000, // Synching period
                60000 * 5, // Checkpointing period
                2000000000L, // Log file size
                100, // Key max size
                2048, // Nb of buffers
                32768, // Nb of entries (buckets) per buffer
                60, // Compact interval
                8, // Read threads
                TEST_COUNT / 3 * 2 * 140, // NeedleHeaderCachedEntries (1/20 in cache, 1/2 of typical data set)
                TEST_COUNT / 3 * 2 * 140, // NeedleCachedBytes (3% of Map, weights 120 bytes/entry)
                true, // Use needle average age instead of needle yougest age
                (short) 0, (short) 0, 0, new TokenSynchronizer(1), new TokenSynchronizer(1), null);
        // dmm.getBtm().getCheckPoint().copyFrom(new NeedlePointer()) ; // Removes checkpoint

        // System.out.println("Start read for "+TEST_COUNT+" pointers") ;
        Date startDate = new Date();
        Date lapDate = new Date();
        System.out.println("Start read test for " + TEST_COUNT + " pointers");
        long counter = 0;
        long lapCounter = 0;
        startDate = new Date();
        lapDate = new Date();
        long failCount = 0;
        counter = 0;
        while (counter < TEST_COUNT) {
            String key = "MYVERYNICELEY" + counter;
            // System.out.println("key="+key+"...") ;
            List<Versioned<byte[]>> values = dmm.get(key.getBytes("UTF-8"));
            if (values.size() <= 0) {
                failCount++;
            } else {
                // Gets previous version   
                byte[] value = values.get(0).getValue();
                if (value == null)
                    failCount++;
                else if (value[0] != (byte) ((short) counter % 128))
                    failCount++;
            }
            counter++;
            Date lapDate2 = new Date();
            long spent = lapDate2.getTime() - lapDate.getTime();
            if (spent >= 1000 || (counter - lapCounter > TARGET_TPSR)) { // Check each second or target tps
                if (spent < 1000) { // pause when tps reached
                    Thread.sleep(1000 - spent);
                    // System.out.print(".") ;
                } else
                    // System.out.print("*") ;
                    lapDate = lapDate2; // Reset lap time
                lapCounter = counter; // Reset tps copunter
            }
        }
        long timeSpent = new Date().getTime() - startDate.getTime();
        System.out.println("\n\nProcessed reading of " + TEST_COUNT + " pointers \n" + "\tTotal time: "
                + timeSpent / 1000 + "s\n" + "\tThroughput: " + (TEST_COUNT * 1000 / timeSpent) + " tps\n"
                + "\tBad results: " + failCount);

        startDate = new Date();
        lapDate = new Date();
        System.out.println("Start write test for " + TEST_COUNT + " pointers");
        counter = 0;
        lapCounter = 0;

        while (counter < TEST_COUNT) {
            String key = "MYVERYNICELEY" + counter;
            // System.out.println("key="+key+"...") ;
            byte[] value = new byte[128000];
            value[0] = (byte) ((short) counter % 128);
            long chaseDurer = new Date().getTime();
            List<Versioned<byte[]>> previousValues = dmm.get(key.getBytes("UTF-8"));
            long chaseDurer2 = new Date().getTime();
            // System.out.println("Get in "+(chaseDurer2 -chaseDurer)+"ms") ;
            chaseDurer = chaseDurer2;
            Version newVersion = null;
            if (previousValues.size() <= 0) {
                newVersion = new VectorClock();
            } else {
                // Gets previous version
                newVersion = previousValues.get(0).cloneVersioned().getVersion();
            }
            // Increment version before writing
            ((VectorClock) newVersion).incrementVersion(dmm.getNodeId(), new Date().getTime());
            dmm.put(key.getBytes("UTF-8"), value, newVersion);
            chaseDurer2 = new Date().getTime();
            // System.out.println("Put in "+(chaseDurer2 -chaseDurer)+"ms") ;
            // dmm.putValue(key.getBytes("UTF-8"), value) ;
            counter++;
            Date lapDate2 = new Date();
            long spent = lapDate2.getTime() - lapDate.getTime();
            if (spent >= 1000 || (counter - lapCounter > TARGET_TPS)) { // Check each second or target tps
                if (spent < 1000) { // pause when tps reached
                    Thread.sleep(1000 - spent);
                    // System.out.print("("+counter+")") ;
                } else
                    // System.out.print("["+counter+"]") ;
                    lapDate = lapDate2; // Reset lap time
                lapCounter = counter; // Reset tps copunter
            }
        }

        timeSpent = new Date().getTime() - startDate.getTime();
        System.out.println("\n\nWriting before cache commit of " + TEST_COUNT + " pointers \n"
                + "\tTotal time: " + timeSpent / 1000 + "s\n" + "\tThroughput: "
                + (TEST_COUNT * 1000 / timeSpent) + " tps");

        System.out.println("Start read for " + TEST_COUNT + " pointers");
        startDate = new Date();
        lapDate = new Date();
        failCount = 0;
        counter = 0;
        while (counter < TEST_COUNT) {
            String key = "MYVERYNICELEY" + counter;
            // System.out.println("key="+key+"...") ;
            List<Versioned<byte[]>> values = dmm.get(key.getBytes("UTF-8"));
            if (values.size() <= 0) {
                failCount++;
            } else {
                // Gets previous version   
                byte[] value = values.get(0).getValue();
                if (value == null)
                    failCount++;
                else if (value[0] != (byte) ((short) counter % 128))
                    failCount++;
            }
            counter++;
            Date lapDate2 = new Date();
            long spent = lapDate2.getTime() - lapDate.getTime();
            if (spent >= 1000 || (counter - lapCounter > TARGET_TPSR)) { // Check each second or target tps
                if (spent < 1000) { // pause when tps reached
                    Thread.sleep(1000 - spent);
                    // System.out.print(".") ;
                } else
                    // System.out.print("*") ;
                    lapDate = lapDate2; // Reset lap time
                lapCounter = counter; // Reset tps copunter
            }
        }
        timeSpent = new Date().getTime() - startDate.getTime();
        System.out.println("\n\nProcessed reading of " + TEST_COUNT + " pointers \n" + "\tTotal time: "
                + timeSpent / 1000 + "s\n" + "\tThroughput: " + (TEST_COUNT * 1000 / timeSpent) + " tps\n"
                + "\tBad results: " + failCount);

        dmm.stopService();
        System.out.println("Max cycle time = "
                + (dmm.getBtm().getMaxCycleTimePass1() + dmm.getBtm().getMaxCycleTimePass2()));

    } catch (Throwable th) {
        th.printStackTrace();
    }

}

From source file:com.yobidrive.diskmap.needles.NeedleManager.java

public static void main(String[] args) {

    try {/*from   ww w  .j  a  v a 2 s  .  co  m*/
        BasicConfigurator.configure();
        NeedleManager nw = new NeedleManager("/Users/Francois/Documents/NEEDLES", 1000000000L, 8, 10000000L,
                10000000L, 0);
        nw.initialize();

        Runtime runtime = Runtime.getRuntime();
        long before = runtime.totalMemory() - runtime.freeMemory();

        // Measure cache impact
        for (long i = 0; i < TEST_COUNT; i++) {
            NeedlePointer np = new NeedlePointer();
            np.setNeedleOffset(i);
            Needle n = new Needle();
            n.setKey("kjdskljsdhklgjfdklgh");
            n.setData(new byte[10000]);
            nw.needleHeaderReadCache.put(np, n.getNeedleHeader(np));
        }
        runtime = Runtime.getRuntime();
        long after = runtime.totalMemory() - runtime.freeMemory();
        System.out.println(
                "Usage=" + ((after - before) / TEST_COUNT) + ", total= " + ((after - before) / (1024 * 1024)));

        /*
        long counter = 0 ;
        int initialLogNumber = nw.getLogNumber() ;
        Date startDate = new Date() ;
        System.out.println("Start test for "+TEST_COUNT+" needles with 10K bytes data") ;
        while ( counter < TEST_COUNT ) {
           Needle needle = new Needle() ;
           needle.setKey("KEY_"+counter) ;
           VectorClock vc = new VectorClock(new Date().getTime()) ;
           needle.setVersion(vc) ;
           needle.setData(testData) ;
           nw.writeNewNeedle(needle) ;
           counter++ ;
           if ( counter % 10000 == 0 )
              System.out.print(".") ;
        }
        long timeSpent = new Date().getTime() - startDate.getTime() ;
        System.out.println("\n\nProcessed creation of "+TEST_COUNT+" needles with 10K bytes data each\n"+
          "\tInital log number: "+initialLogNumber+"\n"+
          "\tFinal log number: "+nw.getLogNumber()+"\n"+
          "\tTotal time: "+timeSpent/1000+"s\n"+
          "\tThroughput: "+TEST_COUNT*testData.length/(timeSpent/1000)+" byte/s\n"+
          "\t            "+TEST_COUNT/(timeSpent/1000)+" needle/s") ;
        */
    } catch (Throwable th) {
        th.printStackTrace();
    }

}

From source file:org.argouml.application.Main.java

/**
 * The main entry point of ArgoUML.//w w  w .  jav  a  2  s . c  o  m
 * @param args command line parameters
 */
public static void main(String[] args) {
    try {
        LOG.info("ArgoUML Started.");

        SimpleTimer st = new SimpleTimer();
        st.mark("begin");

        initPreinitialize();

        st.mark("arguments");
        parseCommandLine(args);

        // Register our last chance exception handler
        AwtExceptionHandler.registerExceptionHandler();

        // Get the splash screen up as early as possible
        st.mark("create splash");
        SplashScreen splash = null;
        if (!batch) {
            // We have to do this to set the LAF for the splash screen
            st.mark("initialize laf");
            LookAndFeelMgr.getInstance().initializeLookAndFeel();
            if (theTheme != null) {
                LookAndFeelMgr.getInstance().setCurrentTheme(theTheme);
            }
            if (doSplash) {
                splash = initializeSplash();
            }
        }

        // main initialization happens here
        ProjectBrowser pb = initializeSubsystems(st, splash);

        // Needs to happen after initialization is done & modules loaded
        st.mark("perform commands");
        if (batch) {
            // TODO: Add an "open most recent project" command so that 
            // command state can be decoupled from user settings?
            performCommandsInternal(commands);
            commands = null;

            System.out.println("Exiting because we are running in batch.");
            new ActionExit().doCommand(null);
            return;
        }

        if (reloadRecent && projectName == null) {
            projectName = getMostRecentProject();
        }

        URL urlToOpen = null;
        if (projectName != null) {
            projectName = PersistenceManager.getInstance().fixExtension(projectName);
            urlToOpen = projectUrl(projectName, urlToOpen);
        }

        openProject(st, splash, pb, urlToOpen);

        st.mark("perspectives");
        if (splash != null) {
            splash.updateProgress(75);
        }

        st.mark("open window");
        updateProgress(splash, 95, "statusmsg.bar.open-project-browser");
        ArgoFrame.getFrame().setVisible(true);

        st.mark("close splash");
        if (splash != null) {
            splash.setVisible(false);
            splash.dispose();
            splash = null;
        }

        // Aufrufen der Aufgabenstellung
        if (taskID != null) {
            ActionShowTask task = new ActionShowTask();
            task.showTask();
            if (projectName == null && ActionShowTask.taskDescription != null
                    && (ActionShowTask.taskDescription.toLowerCase().contains("aktivittsdiagramm")
                            || ActionShowTask.taskDescription.toLowerCase().contains("aktivitts-diagramm")
                            || ActionShowTask.taskDescription.toLowerCase().contains("aktivit&auml;tsdiagramm")
                            || ActionShowTask.taskDescription.toLowerCase().contains("aktivit&auml;ts-diagramm")
                            || ActionShowTask.taskDescription.toLowerCase().contains("activity diagram")
                            || ActionShowTask.taskDescription.toLowerCase().contains("activity-diagram"))) {
                new ActionActivityDiagram().actionPerformed(null);
            }
        }

        performCommands(commands);
        commands = null;

        st.mark("start critics");
        Runnable startCritics = new StartCritics();
        Main.addPostLoadAction(startCritics);

        st.mark("start loading modules");
        Runnable moduleLoader = new LoadModules();
        Main.addPostLoadAction(moduleLoader);

        PostLoad pl = new PostLoad(postLoadActions);
        Thread postLoadThead = new Thread(pl);
        postLoadThead.start();

        LOG.info("");
        LOG.info("profile of load time ############");
        for (Enumeration i = st.result(); i.hasMoreElements();) {
            LOG.info(i.nextElement());
        }
        LOG.info("#################################");
        LOG.info("");

        st = null;
        ArgoFrame.getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));

        // Andreas: just temporary: a warning dialog for uml2...
        if (showUml2warning && Model.getFacade().getUmlVersion().startsWith("2")) {
            JOptionPane.showMessageDialog(ArgoFrame.getFrame(),
                    "You are running an experimental version not meant for productive work!",
                    "UML2 pre-alpha warning", JOptionPane.WARNING_MESSAGE);
        }

        //ToolTipManager.sharedInstance().setInitialDelay(500);
        ToolTipManager.sharedInstance().setDismissDelay(50000000);
    } catch (Throwable t) {
        try {
            LOG.fatal("Fatal error on startup.  ArgoUML failed to start", t);
        } finally {
            System.out.println("Fatal error on startup.  " + "ArgoUML failed to start.");
            t.printStackTrace();
            System.exit(1);
        }
    }
}

From source file:brainflow.app.toplevel.BrainFlow.java

public static void main(String[] args) {

    final BrainFlow bflow = get();

    //Class myClass = BrainFlow.class;
    //URL url = myClass.getResource("BrainFlow.class");
    //System.out.println("class located: " + url);

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            try {
                log.info("Launching BrainFlow ...");
                bflow.launch();//from  ww w.j a  v a  2s .c o  m
            } catch (Throwable e) {
                Logger.getAnonymousLogger().severe("Error Launching BrainFlow, exiting");
                e.printStackTrace();
                System.exit(-1);

            }

        }
    });

}

From source file:com.t3.client.TabletopTool.java

public static void main(String[] args) {
    if (MAC_OS_X) {
        // On OSX the menu bar at the top of the screen can be enabled at any time, but the
        // title (ie. name of the application) has to be set before the GUI is initialized (by
        // creating a frame, loading a splash screen, etc).  So we do it here.
        System.setProperty("apple.laf.useScreenMenuBar", "true");
        System.setProperty("com.apple.mrj.application.apple.menu.about.name", "About TabletopTool...");
        System.setProperty("apple.awt.brushMetalLook", "true");
    }/*from ww w .j a  v  a2 s  .  c  o  m*/
    // Before anything else, create a place to store all the data
    try {
        AppUtil.getAppHome();
    } catch (Throwable t) {
        t.printStackTrace();

        // Create an empty frame so there's something to click on if the dialog goes in the background
        JFrame frame = new JFrame();
        SwingUtil.centerOnScreen(frame);
        frame.setVisible(true);

        String errorCreatingDir = "Error creating data directory";
        log.error(errorCreatingDir, t);
        JOptionPane.showMessageDialog(frame, t.getMessage(), errorCreatingDir, JOptionPane.ERROR_MESSAGE);
        System.exit(1);
    }
    verifyJavaVersion();

    configureLogging();

    // System properties
    System.setProperty("swing.aatext", "true");
    // System.setProperty("sun.java2d.opengl", "true");

    final SplashScreen splash = new SplashScreen(SPLASH_IMAGE, getVersion());
    splash.showSplashScreen();

    // Protocol handlers
    // cp:// is registered by the RPTURLStreamHandlerFactory constructor (why?)
    RPTURLStreamHandlerFactory factory = new RPTURLStreamHandlerFactory();
    factory.registerProtocol("asset", new AssetURLStreamHandler());
    URL.setURLStreamHandlerFactory(factory);

    MacroEngine.initialize();
    configureJide(); //TODO find out how to not call this twice without destroying error windows

    final Toolkit tk = Toolkit.getDefaultToolkit();
    tk.getSystemEventQueue().push(new T3EventQueue());

    // LAF
    try {

        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        configureJide();
        if (WINDOWS)
            LookAndFeelFactory.installJideExtension(LookAndFeelFactory.XERTO_STYLE);
        else
            LookAndFeelFactory.installJideExtension();
        if (MAC_OS_X) {
            macOSXicon();
        }
        menuBar = new AppMenuBar();
    } catch (Exception e) {
        TabletopTool.showError("msg.error.lafSetup", e);
        System.exit(1);
    }

    /**
     * This is a tweak that makes the Chinese version work better.
     * <p>
     * Consider reviewing <a
     * href="http://en.wikipedia.org/wiki/CJK_characters"
     * >http://en.wikipedia.org/wiki/CJK_characters</a> before making
     * changes. And http://www.scarfboy.com/coding/unicode-tool is also a
     * really cool site.
     */
    if (Locale.CHINA.equals(Locale.getDefault())) {
        // The following font name appears to be "Sim Sun".  It can be downloaded
        // from here:  http://fr.cooltext.com/Fonts-Unicode-Chinese
        Font f = new Font("\u65B0\u5B8B\u4F53", Font.PLAIN, 12);
        FontUIResource fontRes = new FontUIResource(f);
        for (Enumeration<Object> keys = UIManager.getDefaults().keys(); keys.hasMoreElements();) {
            Object key = keys.nextElement();
            Object value = UIManager.get(key);
            if (value instanceof FontUIResource)
                UIManager.put(key, fontRes);
        }
    }

    // Draw frame contents on resize
    tk.setDynamicLayout(true);

    EventQueue.invokeLater(new Runnable() {
        @Override
        public void run() {
            initialize();
            EventQueue.invokeLater(new Runnable() {
                @Override
                public void run() {
                    clientFrame.setVisible(true);
                    splash.hideSplashScreen();
                    EventQueue.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            postInitialize();
                        }
                    });
                }
            });
        }
    });
    // new Thread(new HeapSpy()).start();
}

From source file:net.rptools.maptool.client.MapTool.java

public static void main(String[] args) {
    if (MAC_OS_X) {
        // On OSX the menu bar at the top of the screen can be enabled at any time, but the
        // title (ie. name of the application) has to be set before the GUI is initialized (by
        // creating a frame, loading a splash screen, etc).  So we do it here.
        System.setProperty("apple.laf.useScreenMenuBar", "true");
        System.setProperty("com.apple.mrj.application.apple.menu.about.name", "About MapTool...");
        System.setProperty("apple.awt.brushMetalLook", "true");
    }//from ww  w  .ja  v a2s.  co  m
    // Before anything else, create a place to store all the data
    try {
        AppUtil.getAppHome();
    } catch (Throwable t) {
        t.printStackTrace();

        // Create an empty frame so there's something to click on if the dialog goes in the background
        JFrame frame = new JFrame();
        SwingUtil.centerOnScreen(frame);
        frame.setVisible(true);

        String errorCreatingDir = "Error creating data directory";
        log.error(errorCreatingDir, t);
        JOptionPane.showMessageDialog(frame, t.getMessage(), errorCreatingDir, JOptionPane.ERROR_MESSAGE);
        System.exit(1);
    }
    verifyJavaVersion();

    configureLogging();

    // System properties
    System.setProperty("swing.aatext", "true");
    // System.setProperty("sun.java2d.opengl", "true");

    final SplashScreen splash = new SplashScreen(SPLASH_IMAGE, getVersion());
    splash.showSplashScreen();

    // Protocol handlers
    // cp:// is registered by the RPTURLStreamHandlerFactory constructor (why?)
    RPTURLStreamHandlerFactory factory = new RPTURLStreamHandlerFactory();
    factory.registerProtocol("asset", new AssetURLStreamHandler());
    URL.setURLStreamHandlerFactory(factory);

    final Toolkit tk = Toolkit.getDefaultToolkit();
    tk.getSystemEventQueue().push(new MapToolEventQueue());

    // LAF
    try {
        // If we are running under Mac OS X then save native menu bar look & feel components
        // Note the order of creation for the AppMenuBar, this specific chronology
        // allows the system to set up system defaults before we go and modify things.
        // That is, please don't move these lines around unless you test the result on windows and mac
        String lafname;
        if (MAC_OS_X) {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            menuBar = new AppMenuBar();
            lafname = "net.rptools.maptool.client.TinyLookAndFeelMac";
            UIManager.setLookAndFeel(lafname);
            macOSXicon();
        }
        // If running on Windows based OS, CJK font is broken when using TinyLAF.
        //         else if (WINDOWS) {
        //            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        //            menuBar = new AppMenuBar();
        //         }
        else {
            lafname = "de.muntjak.tinylookandfeel.TinyLookAndFeel";
            UIManager.setLookAndFeel(lafname);
            menuBar = new AppMenuBar();
        }
        // After the TinyLAF library is initialized, look to see if there is a Default.theme
        // in our AppHome directory and load it if there is.  Unfortunately, changing the
        // search path for the default theme requires subclassing TinyLAF and because
        // we have both the original and a Mac version that gets cumbersome.  (Really
        // the Mac version should use the default and then install the keystroke differences
        // but what we have works and I'm loathe to go playing with it at 1.3b87 -- yes, 87!)
        File f = AppUtil.getAppHome("config");
        if (f.exists()) {
            File f2 = new File(f, "Default.theme");
            if (f2.exists()) {
                if (Theme.loadTheme(f2)) {
                    // re-install the Tiny Look and Feel
                    UIManager.setLookAndFeel(lafname);

                    // Update the ComponentUIs for all Components. This
                    // needs to be invoked for all windows.
                    //SwingUtilities.updateComponentTreeUI(rootComponent);
                }
            }
        }

        com.jidesoft.utils.Lm.verifyLicense("Trevor Croft", "rptools", "5MfIVe:WXJBDrToeLWPhMv3kI2s3VFo");
        LookAndFeelFactory.addUIDefaultsCustomizer(new LookAndFeelFactory.UIDefaultsCustomizer() {
            public void customize(UIDefaults defaults) {
                // Remove red border around menus
                defaults.put("PopupMenu.foreground", Color.lightGray);
            }
        });
        LookAndFeelFactory.installJideExtension(LookAndFeelFactory.XERTO_STYLE);

        /****************************************************************************
         * For TinyLAF 1.3.04 this is how the color was changed for a
         * button.
         */
        // Theme.buttonPressedColor[Theme.style] = new ColorReference(Color.gray);

        /****************************************************************************
         * And this is how it's done in TinyLAF 1.4.0 (no idea about the
         * intervening versions).
         */
        Theme.buttonPressedColor = new SBReference(Color.GRAY, 0, -6, SBReference.SUB3_COLOR);

        configureJide();
    } catch (Exception e) {
        MapTool.showError("msg.error.lafSetup", e);
        System.exit(1);
    }

    /**
     * This is a tweak that makes the Chinese version work better.
     * <p>
     * Consider reviewing <a
     * href="http://en.wikipedia.org/wiki/CJK_characters"
     * >http://en.wikipedia.org/wiki/CJK_characters</a> before making
     * changes. And http://www.scarfboy.com/coding/unicode-tool is also a
     * really cool site.
     */
    if (Locale.CHINA.equals(Locale.getDefault())) {
        // The following font name appears to be "Sim Sun".  It can be downloaded
        // from here:  http://fr.cooltext.com/Fonts-Unicode-Chinese
        Font f = new Font("\u65B0\u5B8B\u4F53", Font.PLAIN, 12);
        FontUIResource fontRes = new FontUIResource(f);
        for (Enumeration<Object> keys = UIManager.getDefaults().keys(); keys.hasMoreElements();) {
            Object key = keys.nextElement();
            Object value = UIManager.get(key);
            if (value instanceof FontUIResource)
                UIManager.put(key, fontRes);
        }
    }

    // Draw frame contents on resize
    tk.setDynamicLayout(true);

    EventQueue.invokeLater(new Runnable() {
        public void run() {
            initialize();
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    clientFrame.setVisible(true);
                    splash.hideSplashScreen();
                    EventQueue.invokeLater(new Runnable() {
                        public void run() {
                            postInitialize();
                        }
                    });
                }
            });
        }
    });
    // new Thread(new HeapSpy()).start();
}

From source file:com.intuit.tank.tools.debugger.AgentDebuggerFrame.java

/**
 * @param args/*from w w w  .ja  v a2s .  c om*/
 */
public static void main(String[] args) {
    try {
        java.security.Security.setProperty("networkaddress.cache.ttl", "0");
    } catch (Throwable e1) {
        LOG.warn(LogUtil.getLogMessage("Error setting dns timeout: " + e1.toString(), LogEventType.System));
    }
    try {
        System.setProperty("jsse.enableSNIExtension", "false");
    } catch (Throwable e1) {
        LOG.warn(LogUtil.getLogMessage("Error disabling SNI extension: " + e1.toString(), LogEventType.System));
    }
    try {
        System.setProperty("jdk.certpath.disabledAlgorithms", "");
    } catch (Throwable e1) {
        System.err.println("Error setting property jdk.certpath.disabledAlgorithms: " + e1.toString());
        e1.printStackTrace();
    }
    String url = "";
    if (args.length > 0) {
        url = args[0];
    }
    Properties props = new Properties();
    try {
        InputStream configStream = AgentDebuggerFrame.class.getResourceAsStream("/log4j.properties");
        props.load(configStream);
        configStream.close();
    } catch (IOException e) {
        System.out.println("Error: Cannot laod configuration file ");
    }
    props.setProperty("log4j.appender.agent.File", "debugger.log");
    LogManager.resetConfiguration();
    PropertyConfigurator.configure(props);

    new AgentDebuggerFrame(true, url).setVisible(true);
}

From source file:br.com.jinsync.view.FrmJInSync.java

/**
 * Launch the application.// w  ww. j  a va  2 s.c o  m
 */
public static void main(String[] args) {
    try {
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    } catch (Throwable e) {
        e.printStackTrace();
    }

    EventQueue.invokeLater(new Runnable() {
        @Override
        public void run() {
            try {
                frmJInSync = new FrmJInSync();
                frmJInSync.setLocationRelativeTo(null);
                frmJInSync.setVisible(true);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });

}

From source file:com.adito.agent.client.Agent.java

/**
 * Entry point./*from w  w  w  .j  a  v a  2s  .c o m*/
 * 
 * @param args arguments
 */
public static void main(String[] args) throws Throwable {
    try {
        // #ifdef DEBUG
        org.apache.log4j.BasicConfigurator.configure();
        // #endif

        AgentArgs agentArgs = Agent.initArgs(args);

        Agent agent = Agent.initAgent(agentArgs);

        if (agentArgs.isDisableNewSSLEngine())
            SSLTransportFactory.setTransportImpl(SSLTransportImpl.class);

        agent.initMain(agentArgs.getHostname(), agentArgs.getPort(), agentArgs.isSecure(),
                agentArgs.getUsername(), agentArgs.getPassword(), agentArgs.getTicket());

        if (agentArgs.getExtensionClasses() != null)
            agent.startExtensions(agentArgs.getExtensionClasses());
    } catch (Throwable t) {
        // Catch any nasties to make sure we exit
        // #ifdef DEBUG
        if (log != null) {
            log.error("Critical error, shutting down.", t); //$NON-NLS-1$
        } else {
            System.err.println("Critical error, shutting down.");
            t.printStackTrace();
        }
        // #endif
        throw t;
    }
}