Start MultiBit user interface. @param args String encoding of arguments ([0]= Bitcoin URI)
(String args[])
| 87 | * @param args String encoding of arguments ([0]= Bitcoin URI) |
| 88 | */ |
| 89 | @SuppressWarnings("deprecation") |
| 90 | public static void main(String args[]) { |
| 91 | log.info("Starting MultiBit at " + (new Date()).toGMTString()); |
| 92 | // Print out all the system properties. |
| 93 | for (Map.Entry<?,?> e : System.getProperties().entrySet()) { |
| 94 | log.debug(String.format("%s = %s", e.getKey(), e.getValue())); |
| 95 | } |
| 96 | |
| 97 | ViewSystem swingViewSystem = null; |
| 98 | // Enclosing try to enable graceful closure for unexpected errors. |
| 99 | try { |
| 100 | // Set any bespoke system properties. |
| 101 | try { |
| 102 | // Fix for Windows / Java 7 / VPN bug. |
| 103 | System.setProperty("java.net.preferIPv4Stack", "true"); |
| 104 | |
| 105 | // Fix for version.txt not visible for Java 7 |
| 106 | System.setProperty ("jsse.enableSNIExtension", "false"); |
| 107 | } catch (SecurityException se) { |
| 108 | log.error(se.getClass().getName() + " " + se.getMessage()); |
| 109 | } |
| 110 | |
| 111 | ApplicationDataDirectoryLocator applicationDataDirectoryLocator = new ApplicationDataDirectoryLocator(); |
| 112 | |
| 113 | // Load up the user preferences. |
| 114 | Properties userPreferences = FileHandler.loadUserPreferences(applicationDataDirectoryLocator); |
| 115 | |
| 116 | // Create the controllers. |
| 117 | coreController = new CoreController(applicationDataDirectoryLocator); |
| 118 | controller = coreController; |
| 119 | bitcoinController = new BitcoinController(coreController); |
| 120 | exchangeController = new ExchangeController(coreController); |
| 121 | |
| 122 | log.info("Configuring native event handling"); |
| 123 | GenericApplicationSpecification specification = new GenericApplicationSpecification(); |
| 124 | specification.getOpenURIEventListeners().add(coreController); |
| 125 | specification.getPreferencesEventListeners().add(coreController); |
| 126 | specification.getAboutEventListeners().add(coreController); |
| 127 | specification.getQuitEventListeners().add(coreController); |
| 128 | GenericApplication genericApplication = GenericApplicationFactory.INSTANCE.buildGenericApplication(specification); |
| 129 | |
| 130 | log.info("Checking to see if this is the primary MultiBit instance"); |
| 131 | String rawURI = null; |
| 132 | if (args != null && args.length > 0) { |
| 133 | rawURI = args[0]; |
| 134 | log.debug("The args[0] passed into MultiBit = '" + args[0] +"'"); |
| 135 | } |
| 136 | if (!ApplicationInstanceManager.registerInstance(rawURI)) { |
| 137 | // Instance already running. |
| 138 | log.debug("Another instance of MultiBit is already running. Exiting."); |
| 139 | System.exit(0); |
| 140 | } |
| 141 | |
| 142 | final BitcoinController finalController = bitcoinController; |
| 143 | ApplicationInstanceManager.setApplicationInstanceListener(new ApplicationInstanceListener() { |
| 144 | @Override |
| 145 | public void newInstanceCreated(String rawURI) { |
| 146 | final String finalRawUri = rawURI; |
no test coverage detected