List of usage examples for java.lang System setProperty
public static String setProperty(String key, String value)
From source file:com.sundy.SpringBootZookeeperRpcClientDemo.java
public static void main(String[] args) { System.setProperty("server.port", "8083"); SpringApplication.run(SpringBootZookeeperRpcClientDemo.class, args); System.out.println("springboot zookeeper client start..."); }
From source file:test.SomeMainClass.java
public static void main(String[] args) throws Exception { Configuration cfg = new Configuration(); cfg.size();/*from w w w . ja v a 2 s . c o m*/ System.out.println("*** New Config is ***" + dumpConfiguration(cfg).toString()); System.getProperties().put("org.springframework.data.hadoop.jar.cfg", cfg); System.getProperties().put("org.springframework.data.hadoop.jar.args", args); System.setProperty("org.springframework.data.jar.exit.pre", "true"); try { System.exit(1); } catch (Throwable th) { System.getProperties().put("org.springframework.data.jar.exit.exception", th); } }
From source file:net.sf.janos.Janos.java
/** * @param args//from w w w.j av a2s .c o m * @throws Exception */ public static void main(String[] args) { if (args.length > 1) { System.out.println("Usage: Janos [port]"); System.exit(1); } if (args.length == 1) { System.setProperty("net.sbbi.upnp.Discovery.bindPort", args[0]); } /* * [DW] For some reason unknown to me, given: * 1) arch is intel * 2) os is Mac OS X * 3) running in eclipse * 4) using SWT * no exceptions are displayed in the eclipse console in the main thread. * To work around this, we just do everything in a new thread :-) */ if (Boolean.getBoolean("net.sf.janos.forkNewThread")) { try { Thread mainThread = new Thread(new Janos(), "Janos-SWT"); mainThread.start(); mainThread.join(); } catch (Throwable t) { LogFactory.getLog(Janos.class).fatal("Could not start thread: ", t); System.exit(1); } } else { new Janos().run(); } }
From source file:com.discursive.jccook.httpclient.ConditionalGetExample.java
public static void main(String[] args) throws HttpException, IOException { // Configure Logging System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog"); System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true"); System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "debug"); System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", "debug"); ConditionalGetExample example = new ConditionalGetExample(); example.start();//from w w w . j av a 2s. co m }
From source file:CommandsFromZipFile.java
/** * Sample test to retrieve command value using zip file * @param args/*w ww. j a va 2s . co m*/ */ public static void main(String[] args) { //by default it sets to Ctrl+D System.setProperty("jline.shutdownhook", "true"); try { ConsoleReader consoleReader = new ConsoleReader(); consoleReader.setPrompt("carbon>"); consoleReader.addCompleter(new StringsCompleter(IOUtils.readLines( new GZIPInputStream(CommandsFromZipFile.class.getResourceAsStream("commandList.txt.gz"))))); consoleReader.addCompleter(new FileNameCompleter()); String line = ""; String colored = ""; while ((line = consoleReader.readLine()) != null) { if ("clear".equals(line.trim())) { System.out.print("\33[2J"); System.out.flush(); System.out.print("\33[1;1H"); System.out.flush(); } else if ("aback".equals(line.trim())) { colored = Ansi.ansi().fg(Ansi.Color.RED).a("Entered command : ") .a(Ansi.Attribute.INTENSITY_BOLD).a(line).a(Ansi.Attribute.INTENSITY_BOLD_OFF) .fg(Ansi.Color.DEFAULT).toString(); consoleReader.println(colored); } else { consoleReader.println(line); } } } catch (IOException exception) { LOGGER.error(" Unable to load commands from the zip file ", exception); } finally { try { jline.TerminalFactory.get().restore(); } catch (Exception exception) { LOGGER.error(" Unable to restore the terminal ", exception); } } }
From source file:com.cxf.sts.WSO2STSTest.java
public static void main(String[] args) throws ParserConfigurationException { System.out.println("base folder - " + new File("").getAbsolutePath()); System.setProperty("javax.net.ssl.trustStore", "/home/kasun/wso2/products/420-packs/wso2is-4.6.0/repository/resources/security/client-truststore.jks"); System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon"); ApplicationContext ctx = new FileSystemXmlApplicationContext("classpath:wssec-sts-bean.xml"); doSTS(ctx);//from w ww.java 2 s .co m }
From source file:com.google.cloud.trace.zipkin.StackdriverZipkinCollector.java
public static void main(String[] args) { System.setProperty("stackdriver.trace.zipkin.agent", "zipkin-java-collector"); new SpringApplicationBuilder(StackdriverZipkinCollector.class).properties(ZIPKIN_CONFIG_NAMES).run(args); }
From source file:com.dc.gameserver.launcher.java
public static void main(String[] args) { try {// w ww. j a va 2s . c o m DOMConfigurator.configure(Config.DEFAULT_VALUE.FILE_PATH.LOG4J); System.setProperty("java.net.preferIPv4Stack", "true"); //Disable IPv6 in JVM /**?spring*/ BeanFactory springContext = new FileSystemXmlApplicationContext( Config.DEFAULT_VALUE.FILE_PATH.SPRING_CONFIG_PATH); launcher gameServer = (launcher) springContext.getBean("gameServer"); /**set spring context**/ ServerHandler.setSpringContext(springContext); /**???*/ gameServer.serverService.IntiServer(); gameServer.serverService.run(); } catch (Exception e) { LOG.error("server start error", e); } }
From source file:com.ish.client.Http2BootClient.java
public static void main(String[] args) throws Exception { System.setProperty("javax.net.ssl.trustStore", Http2BootClient.class.getResource("/keystore").getPath()); // Run SpringBoot app ConfigurableApplicationContext context = SpringApplication.run(Http2BootClient.class, args); // Create Guice Injector Injector injector = Guice.createInjector(new SpringModule(context)); AccountService accountService = injector.getInstance(AccountService.class); insertAccounts(accountService);//www . j a v a 2s. c om printAccountsInformation(accountService); }
From source file:org.openpplsoft.Main.java
/** * Main entry point for the OPS runtime. * @param args command line args to main *//*from w ww . j av a 2s .co m*/ public static void main(final String[] args) { // The name of the environment to access is expected at args[0] System.setProperty("contextFile", args[0] + ".xml"); ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(System.getProperty("contextFile")); // The name of the component to load is expected at args[1] ComponentRuntimeProfile profileToRun = (ComponentRuntimeProfile) ctx.getBean(args[1]); try { Runtime.getRuntime().addShutdownHook(new ENTShutdownHook()); TraceFileVerifier.init(profileToRun); Environment.init((String) ctx.getBean("psEnvironmentName"), profileToRun.getOprid()); Environment.setSystemVar("%Component", new PTString(profileToRun.getComponentName())); Environment.setSystemVar("%Menu", new PTString("SA_LEARNER_SERVICES")); Environment.setSystemVar("%Mode", new PTString(profileToRun.getMode())); Environment.setSystemVar("%Action_UpdateDisplay", new PTString("U")); Environment.setSystemVar("%Action_Add", new PTString("A")); /* * The following system vars can theoretically vary among environments. * However, at the moment, I am running this on identically configured * vanilla PS instances. Therefore, I am not going to externalize these * values for the time being. */ Environment.setSystemVar("%Portal", new PTString("EMPLOYEE")); Environment.setSystemVar("%Node", new PTString("HRMS")); // Since we are verifying against a tracefile, we have to override // the default current date and time with the date and time // on/at which the tracefile was generated. Environment.setSystemVar("%Date", profileToRun.getTraceFileDate()); Environment.setSystemVar("%Time", profileToRun.getTraceFileDateTime()); final Component c = DefnCache.getComponent((String) Environment.getSystemVar("%Component").read(), "GBL"); // Set %Page to the name of the first page in the component. Environment.setSystemVar("%Page", new PTString(c.getPages().get(0).getPNLNAME())); DefnCache.getMenu((String) Environment.getSystemVar("%Menu").read()); ComponentBuffer.init(c); ComponentBuffer.getSearchRecord().fireEvent(PCEvent.SEARCH_INIT, new FireEventSummary()); ComponentBuffer.fillSearchRecord(); ComponentBuffer.assembleBuffers(); ComponentBuffer.expandRecordBuffersWhereNecessary(); ComponentBuffer.addEffDtKeyWhereNecessary(); ComponentBuffer.logPageHierarchyVisual(); ComponentBuffer.printStructure(); ComponentStructureVerifier.verify(profileToRun); ComponentBuffer.materialize(); ComponentBuffer.emitPRM(); ComponentBuffer.firstPassFill(); ComponentBuffer.fireEvent(PCEvent.PRE_BUILD, new FireEventSummary()); ComponentBuffer.runRelatedDisplayProcessing(); ComponentBuffer.runDefaultProcessing(); ComponentBuffer.fireEvent(PCEvent.ROW_INIT, new FireEventSummary()); ComponentBuffer.fireEvent(PCEvent.POST_BUILD, new FireEventSummary()); TraceFileVerifier.logVerificationSummary(false); } catch (final OPSVMachRuntimeException opsvmre) { log.fatal(opsvmre.getMessage(), opsvmre); TraceFileVerifier.logVerificationSummary(true); System.exit(1); } }