List of usage examples for java.lang Boolean getBoolean
public static boolean getBoolean(String name)
From source file:Main.java
public static void main(String[] args) { System.setProperty("java2s1", "true"); System.setProperty("java2s2", "abcd"); boolean bool1 = Boolean.getBoolean("java2s1"); boolean bool2 = Boolean.getBoolean("java2s2"); System.out.println("boolean value of system property java2s1 is " + bool1); System.out.println("boolean value of system property java2s2 is " + bool2); }
From source file:PropView.java
public static void main(String args[]) throws Exception { Properties properties = System.getProperties(); properties.list(System.out);//ww w.j a v a 2 s . com FileInputStream in = null; in = new FileInputStream(args[0]); properties.load(in); System.getProperties().list(System.out); System.out.println("\nValue of local.animal.defined is " + Boolean.getBoolean("local.animal.defined")); System.out.println("\nValue of local.animal.legcount is " + Integer.getInteger("local.animal.legcount")); }
From source file:sasc.Main.java
/** * @param args the command line arguments *///from w ww . j a v a2s. com public static void main(String[] args) { //Default values boolean noGUI = Boolean.getBoolean("java.awt.headless"); boolean emulate = false; boolean listTerminals = false; boolean verbose = false; //Commons CLI //http://commons.apache.org/cli/usage.html Option helpOption = new Option("help", "print this message"); Option noGUIOption = new Option("noGUI", "use command line version"); Option emulateOption = new Option("emulate", "emulate communication with an EMV card"); Option listTerminalsOption = new Option("listTerminals", "list all available terminals"); Option terminalOption = new Option("terminal", "the name of the terminal to use"); Option verboseOption = new Option("verbose", "print debug messages"); Options options = new Options(); options.addOption(helpOption); options.addOption(noGUIOption); options.addOption(emulateOption); options.addOption(listTerminalsOption); options.addOption(terminalOption); options.addOption(verboseOption); // create the cmd line parser CommandLineParser parser = new GnuParser(); try { // parse the command line arguments CommandLine line = parser.parse(options, args); if (line.hasOption("help")) { // automatically generate the help statement HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("BLABLA", options, true); System.exit(0); } if (line.hasOption("listTerminals")) { listTerminals = true; } if (line.hasOption("noGUI")) { noGUI = true; } if (line.hasOption("emulate")) { emulate = true; } if (line.hasOption("verbose")) { verbose = true; } } catch (ParseException ex) { // oops, something went wrong System.err.println("Parsing failed. Reason: " + ex.getMessage()); ex.printStackTrace(System.err); System.exit(-1); } if (listTerminals) { try { TerminalProvider terminalProvider = TerminalAPIManager .getProvider(TerminalAPIManager.SelectionPolicy.ANY_PROVIDER); for (Terminal terminal : terminalProvider.listTerminals()) { System.out.println(terminal.getTerminalInfo()); } System.exit(0); } catch (TerminalException ex) { ex.printStackTrace(System.err); System.exit(-1); } } if (emulate) { try { CardEmulatorMain.main(null); System.exit(0); } catch (TerminalException ex) { ex.printStackTrace(System.err); System.exit(-1); } } if (noGUI) { //No Swing/GUI new CardExplorer().start(); } else { // Create swing app using appframework // http://java.dzone.com/news/jsr-296-end-jframe // https://appframework.dev.java.net/ org.jdesktop.application.Application.launch(GUI.class, args); } }
From source file:net.sf.janos.Janos.java
/** * @param args//w w w .j a v a2 s . c om * @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:dk.dma.nogoservice.Application.java
public static void main(String[] args) { SpringApplicationBuilder builder = new SpringApplicationBuilder(Application.class); ArrayList<String> profiles = Lists.newArrayList(ApiProfiles.PRODUCTION, ApiProfiles.SECURITY); if (Boolean.getBoolean("disableSecurity")) { profiles.remove(ApiProfiles.SECURITY); }/* w w w.j a va2 s .c om*/ builder.profiles(profiles.toArray(new String[profiles.size()])).headless(false).run(args); }
From source file:cz.incad.kramerius.imaging.lp.DeleteGeneratedDeepZoomCache.java
public static void main(String[] args) throws IOException, ProcessSubtreeException { System.out.println("Delete deepZoomCache :" + Arrays.asList(args)); if (args.length == 1) { Injector injector = Guice.createInjector(new GenerateDeepZoomCacheModule(), new Fedora3Module()); FedoraAccess fa = injector.getInstance(Key.get(FedoraAccess.class, Names.named("securedFedoraAccess"))); DiscStrucutreForStore discStruct = injector.getInstance(DiscStrucutreForStore.class); deleteCacheForPID(args[0], fa, discStruct); boolean spawnFlag = Boolean.getBoolean(GenerateDeepZoomFlag.class.getName()); if (spawnFlag) { String[] processArgs = { GenerateDeepZoomFlag.Action.DELETE.name(), args[0] }; ProcessUtils.startProcess("generateDeepZoomFlag", processArgs); }//from w w w . j a va 2s .c o m } }
From source file:com.alvermont.javascript.tools.shell.ShellMain.java
/** * ShellMain entry point.//from w w w.j ava2s .co m * * Process arguments as would a normal Java program. Also * create a new Context and associate it with the current thread. * Then set up the execution environment and begin to * execute scripts. */ public static void main(String[] args) { try { if (Boolean.getBoolean("rhino.use_java_policy_security")) { initJavaPolicySecuritySupport(); } } catch (SecurityException ex) { ex.printStackTrace(System.err); } final int result = exec(args); if (result != 0) { System.exit(result); } }
From source file:net.openhft.chronicle.wire.benchmarks.ComparisonMain.java
public static void main(String... args) throws Exception { Affinity.setAffinity(2);/*from w w w . j av a 2 s . co m*/ if (Jvm.isDebug()) { ComparisonMain main = new ComparisonMain(); for (Method m : ComparisonMain.class.getMethods()) { main.s = null; main.sb.setLength(0); main.mhe.wrap(main.directBuffer, 0).blockLength(0); main.buf = null; if (m.getAnnotation(Benchmark.class) != null) { m.invoke(main); String s = main.s; if (s != null) { System.out.println("Test " + m.getName() + " used " + s.length() + " chars."); System.out.println(s); } else if (main.sb.length() > 0) { System.out.println("Test " + m.getName() + " used " + main.sb.length() + " chars."); System.out.println(main.sb); } else if (main.mhd.wrap(main.directBuffer, 0).blockLength() > 0) { int len = main.mhd.wrap(main.directBuffer, 0).blockLength() + main.mhd.encodedLength(); System.out.println("Test " + m.getName() + " used " + len + " chars."); System.out.println(new NativeBytesStore<>(main.directBuffer.addressOffset(), len) .bytesForRead().toHexString()); } else if (main.buf != null) { System.out.println("Test " + m.getName() + " used " + main.buf.length + " chars."); System.out.println(Bytes.wrapForRead(main.buf).toHexString()); } else if (main.bytes.writePosition() > 0) { main.bytes.readPosition(0); System.out .println("Test " + m.getName() + " used " + main.bytes.readRemaining() + " chars."); System.out.println(main.bytes.toHexString()); } } } } else { int time = Boolean.getBoolean("longTest") ? 30 : 2; System.out.println("measurementTime: " + time + " secs"); Options opt = new OptionsBuilder().include(ComparisonMain.class.getSimpleName()) // .warmupIterations(5) .measurementIterations(5).forks(10).mode(Mode.SampleTime) .measurementTime(TimeValue.seconds(time)).timeUnit(TimeUnit.NANOSECONDS).build(); new Runner(opt).run(); } }
From source file:org.fusesource.meshkeeper.launcher.MeshContainer.java
public static final void main(String[] args) { if (args.length == 0) { System.err.println("Expected registry path"); }//from w w w . j ava 2 s. c o m String path = args[0]; MeshContainer container = new MeshContainer(path); Throwable error = null; try { //Running from RemoteBootstrapper? if (Boolean.getBoolean(RemoteBootstrap.BOOTSTRAP_PROPERTY)) { //If we're running from the bootstrapper set the classloader //to the bootstrap classloader: MeshContainer.mesh = RemoteBootstrap.getMeshKeeper(); mesh.setUserClassLoader(new MeshContainerClassLoader()); } else { MeshContainer.mesh = MeshKeeperFactory.createMeshKeeper(); } DistributionRef<MeshContainerService> ref = MeshContainer.getMeshKeeper().distribute(path, false, (MeshContainerService) container, MeshContainerService.class); MeshContainer.LOG.debug("Started MeshContainer: " + ref.getRegistryPath() + " cl: " + container.getClass().getClassLoader()); container.closeLatch.await(); MeshContainer.LOG.debug("Closing MeshContainer: " + ref.getRegistryPath() + " cl: " + container.getClass().getClassLoader()); } catch (Throwable thrown) { error = error == null ? thrown : error; LOG.error("MeshContainer error: ", thrown); } finally { try { if (mesh != null) { mesh.destroy(); } } catch (Exception thrown) { error = error == null ? thrown : error; LOG.error("MeshContainer error: ", thrown); } System.exit(error == null ? 0 : 1); } }
From source file:com.michaelfitzmaurice.devtools.HeaderTool.java
/** * Runs the Header Tool. Supports optional system properties to * control the matching behaviour (default is full - see class * comments) and what to do with files that do not include the * header (default is simply to report on them): * //from w w w.j a va 2 s. c o m * <pre> * -Dinsert-mode=true * -Dfirst-line-match=true * </pre> * * @param args Runtime arguments, which must include: * <ol> * <li>Full path to source directory</li> * <li>Full path to header file</li> * <li>Variable number of file extensions to check (space separated). * Passing only the * character provides wildcard extension * matching * </li> * </ol> * * @throws IOException */ public static void main(String[] args) throws IOException { File rootDir = new File(args[0]); File headerFile = new File(args[1]); String[] fileExtensions = new String[args.length - 2]; System.arraycopy(args, 2, fileExtensions, 0, fileExtensions.length); if (asList(fileExtensions).contains(WILDCARD_FILE_EXTENSION)) { fileExtensions = null; } MatchMode matchMode = MatchMode.FULL_MATCH; if (Boolean.getBoolean(FIRST_LINE_MATCH_SYS_PROP) == true) { matchMode = MatchMode.FIRST_LINE_ONLY; } HeaderTool headerTool = new HeaderTool(headerFile, matchMode); Collection<File> filesWithNoHeader = headerTool.listFilesWithoutHeader(rootDir, fileExtensions); if (Boolean.getBoolean(INSERT_MODE_SYS_PROP) == true) { headerTool.insertHeader(filesWithNoHeader); } }