List of usage examples for java.lang System setProperty
public static String setProperty(String key, String value)
From source file:de.ipk_gatersleben.ag_nw.graffiti.plugins.gui.webstart.KgmlEdMain.java
/** * The editor's main method./*from w w w .ja va 2s. co m*/ * * @param args * the command line arguments. */ public static void main(String[] args) { GravistoMainHelper.setLookAndFeel(); System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog"); // System.setProperty("java.net.useSystemProxies","true"); ReleaseInfo.setRunningReleaseStatus(Release.KGML_EDITOR); String stS = "<font><b>"; // "<font color=\"#9500C0\"><b>"; String stE = "</b></font>"; String name = stS + "KGML Pathway Editor" + stE + " - " + "Edit, process and visualize KGML" + DBEgravistoHelper.kgmlFileVersionHint + " pathway files!"; JComponent result = new JPanel(); result.setLayout(TableLayout.getLayout(TableLayoutConstants.FILL, TableLayoutConstants.FILL)); String s = "" + "<html><small><br> </small>Welcome to " + name + "<br>" + "<small>" + " If you experience problems or would like to suggest enhancements, feel free to use the <b>Send feedback command</b> in the Help menu!<br> "; ReleaseInfo.setHelpIntroductionText(s); DBEgravistoHelper.DBE_GRAVISTO_VERSION = "KGML Pathway Editor V" + DBEgravistoHelper.DBE_GRAVISTO_VERSION_CODE; DBEgravistoHelper.DBE_GRAVISTO_NAME = stS + "KGML Pathway Editor" + stE + " - " + "Edit, process, <br>and visualize KGML" + DBEgravistoHelper.kgmlFileVersionHint + " Pathway files!<br>"; DBEgravistoHelper.DBE_GRAVISTO_NAME_SHORT = "KGML Pathway Editor"; DBEgravistoHelper.DBE_INFORMATIONSYSTEM_NAME = ""; AttributeHelper.setMacOSsettings(DBEgravistoHelper.DBE_GRAVISTO_NAME_SHORT); new KgmlEdMain(true, DBEgravistoHelper.DBE_GRAVISTO_VERSION, args); }
From source file:com.ibm.replication.iidr.utils.Settings.java
public static void main(String[] args) throws ConfigurationException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IOException { System.setProperty("log4j.configurationFile", System.getProperty("user.dir") + File.separatorChar + "conf" + File.separatorChar + "log4j2.xml"); LoggerContext ctx = (LoggerContext) LogManager.getContext(false); Configuration config = ctx.getConfiguration(); LoggerConfig loggerConfig = config.getLoggerConfig("com.ibm.replication.iidr.utils.Settings"); loggerConfig.setLevel(Level.DEBUG); ctx.updateLoggers();// w w w .jav a 2 s . co m new Settings("CollectCDCStats.properties"); }
From source file:ste.travian.gui.WorldController.java
public static void main(String[] args) throws Exception { ///*from w w w . j av a 2s . c o m*/ // Set default values for the database configuration // String value = System.getProperty(StoreConnection.PROP_JDBC_DRIVER); if (value == null) { System.setProperty(StoreConnection.PROP_JDBC_DRIVER, DEFAULT_JDBC_DRIVER); } value = System.getProperty(StoreConnection.PROP_JDBC_URL); if (value == null) { System.setProperty(StoreConnection.PROP_JDBC_URL, DEFAULT_JDBC_URL); } value = System.getProperty(StoreConnection.PROP_JDBC_USER); if (value == null) { System.setProperty(StoreConnection.PROP_JDBC_USER, DEFAULT_JDBC_USER); } value = System.getProperty(StoreConnection.PROP_JDBC_PASSWORD); if (value == null) { System.setProperty(StoreConnection.PROP_JDBC_PASSWORD, DEFAULT_JDBC_PASSWORD); } // // Tweaks for MacOS UI // Rememeber to add -Xdock:name="Travian world" to the command line... // System.setProperty(PROPERTY_APPLE_USE_MENUBAR, "true"); System.setProperty(PROPERTY_APPLE_ABOUT_NAME, "About Travian World"); System.setProperty(PROPERTY_APPLE_INTRUDES, "true"); // --- new WorldController().showMainWindow(); }
From source file:net.sf.xmm.moviemanager.MovieManager.java
public static void main(String args[]) { boolean sandbox = SysUtil.isRestrictedSandbox(); // Uses this to check if the app is running in a sandbox with limited privileges try {//from www . jav a 2s .c o m /* Disable HTTPClient logging output */ System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog"); //$NON-NLS-1$ //$NON-NLS-2$ } catch (java.security.AccessControlException s) { s.printStackTrace(); sandbox = true; } if (!sandbox) { // Disables logging for cobra html renderer java.util.logging.Logger.getLogger("").setLevel(java.util.logging.Level.OFF); File log4jConfigFile = FileUtil.getFile("config/log4j.properties"); //$NON-NLS-1$ if (log4jConfigFile.isFile()) { PropertyConfigurator.configure(log4jConfigFile.getAbsolutePath()); } else { BasicConfigurator.configure(); } } else BasicConfigurator.configure(); log = Logger.getRootLogger(); // Places the Log file in the user directory (the program location) RollingFileAppender appndr = (RollingFileAppender) log.getAppender("FileAppender"); String logFile = null; try { if (SysUtil.isMac() || SysUtil.isWindowsVista() || SysUtil.isWindows7()) logFile = new File(SysUtil.getConfigDir(), "Log.txt").getAbsolutePath(); } catch (Exception e1) { e1.printStackTrace(); } finally { if (logFile == null) logFile = new File(SysUtil.getUserDir(), "Log.txt").getAbsolutePath(); } if (appndr != null && appndr.getFile() == null) { appndr.setFile(logFile); appndr.activateOptions(); } /* Writes the date. */ log.debug("================================================================================"); //$NON-NLS-1$ log.debug("Log Start: " + new Date(System.currentTimeMillis())); //$NON-NLS-1$ log.debug("MeD's Movie Manager v" + config.sysSettings.getVersion()); //$NON-NLS-1$ log.debug("MovieManager release:" + MovieManager.getConfig().sysSettings.getRelease() + " - " + "IMDb Lib release:" + IMDbLib.getRelease() + " (" + IMDbLib.getVersion() + ")"); log.debug(SysUtil.getSystemInfo(SysUtil.getLineSeparator())); //$NON-NLS-1$ /* Loads the config */ if (!sandbox) config.loadConfig(); // Calls the plugin startup method MovieManagerStartupHandler startupHandler = MovieManager.getConfig().getStartupHandler(); if (startupHandler != null) { startupHandler.startUp(); } if (!sandbox) { if (SysUtil.isAtLeastJRE6()) { SysUtil.includeJarFilesInClasspath("lib/LookAndFeels/1.6"); } SysUtil.includeJarFilesInClasspath("lib/LookAndFeels"); SysUtil.includeJarFilesInClasspath("lib/drivers"); /* Must be called before the GUI is created */ if (SysUtil.isMac()) { SysUtil.includeJarFilesInClasspath("lib/mac"); lookAndFeelManager.setupOSXLaF(); } } movieManager = new MovieManager(); movieManager.sandbox = sandbox; // Loads the HTML templates templateHandler.loadHTMLTemplates(); EventQueue.invokeLater(new Runnable() { public final void run() { try { /* Installs the Look&Feels */ lookAndFeelManager.instalLAFs(); if (!MovieManager.isApplet()) lookAndFeelManager.setLookAndFeel(); log.debug("Look & Feels installed."); log.debug("Creating MovieManager Dialog"); movieManager.createDialog(); /* Starts the MovieManager. */ MovieManager.getDialog().setUp(); log.debug("MovieManager Dialog - setup."); MovieManager.getDialog().showDialog(); /* SetUp the Application Menu for OSX */ if (SysUtil.isMac()) { LookAndFeelManager.macOSXRegistration(MovieManager.getDialog()); } // Calls the plugin startup method MovieManagerLoginHandler loginHandler = MovieManager.getConfig().getLoginHandler(); if (loginHandler != null) { loginHandler.loginStartUp(); } log.debug("Loading Database...."); /* Loads the database. */ databaseHandler.loadDatabase(true); log.debug("Database loaded."); AppUpdater.handleVersionUpdate(); } catch (Exception e) { log.error("Exception occured while intializing MeD's Movie Manager", e); } } }); }
From source file:gov.nih.nci.cacis.common.util.ExtractSchematron.java
/** * Main method, expect at least 4 arguments: location of top-level service XSD, location of ISO datatypes XSD * (optionally followed by a comma and the location of flavors XSD), and the names of the concrete and abstract * schematron schema files to output. Optionally can also provide a 5th argument: a comma-separated list of * additional rule files to bring in.//from www . j a va2 s . c o m * * @param args the command-line arguments */ public static void main(String[] args) { if (args.length < 4) { LOG.warn(USAGE); System.exit(-1); } else { System.setProperty(DOMImplementationRegistry.PROPERTY, "org.apache.xerces.dom.DOMXSImplementationSourceImpl"); try { String ruleFiles = null; // NOPMD to remove DD-anomaly warning if (args.length > 4) { ruleFiles = args[4]; } new ExtractSchematron().extract(args[0], args[1], args[2], args[3], ruleFiles); // CHECKSTYLE:OFF it's a main method, so may as well catch the generic exception } catch (final Exception e) { // CHECKSTYLE:ON LOG.error("Error extracting ", e); } } }
From source file:com.guns.media.tools.yuv.MediaTool.java
/** * @param args the command line arguments *///w w w.jav a 2s .com public static void main(String[] args) throws IOException { try { Options options = getOptions(); CommandLine cmd = null; int offset = 0; CommandLineParser parser = new GnuParser(); cmd = parser.parse(options, args); if (cmd.hasOption("help")) { printHelp(options); exit(1); } if (cmd.hasOption("offset")) { offset = new Integer(cmd.getOptionValue("offset")); } int frame = new Integer(cmd.getOptionValue("f")); // int scale = new Integer(args[2]); BufferedInputStream if1 = new BufferedInputStream(new FileInputStream(cmd.getOptionValue("if1"))); BufferedInputStream if2 = new BufferedInputStream(new FileInputStream(cmd.getOptionValue("if2"))); DataStorage.create(new Integer(cmd.getOptionValue("f"))); int width = new Integer(cmd.getOptionValue("w")); int height = new Integer(cmd.getOptionValue("h")); LookUp.initSSYUV(width, height); // int[][] frame1 = new int[width][height]; // int[][] frame2 = new int[width][height]; int nRead; int fRead; byte[] data = new byte[width * height + ((width * height) / 2)]; byte[] data1 = new byte[width * height + ((width * height) / 2)]; int frames = 0; long start_ms = System.currentTimeMillis() / 1000L; long end_ms = start_ms; if (offset > 0) { if1.skip(((width * height + ((width * height) / 2)) * offset)); } else if (offset < 0) { if2.skip(((width * height + ((width * height) / 2)) * (-1 * offset))); } if (cmd.hasOption("psnr")) { ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newCachedThreadPool(); while ((nRead = if1.read(data)) != -1 && ((fRead = if2.read(data1)) != -1) && frames < frame) { byte[] data_out = data.clone(); byte[] data1_out = data1.clone(); PSNRCalculatorThread wt = new PSNRCalculatorThread(data_out, data1_out, frames, width, height); executor.execute(wt); frames++; } executor.shutdown(); end_ms = System.currentTimeMillis(); System.out.println("Frame Rate :" + frames * 1000 / ((end_ms - start_ms))); for (int i = 0; i < frames; i++) { System.out.println( i + "," + 10 * Math.log10((255 * 255) / (DataStorage.getFrame(i) / (width * height)))); } } if (cmd.hasOption("sub")) { RandomAccessFile raf = new RandomAccessFile(cmd.getOptionValue("o"), "rw"); ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newCachedThreadPool(); while ((nRead = if1.read(data)) != -1 && ((fRead = if2.read(data1)) != -1)) { byte[] data_out = data.clone(); byte[] data1_out = data1.clone(); ImageSubstractThread wt = new ImageSubstractThread(data_out, data1_out, frames, width, height, raf); //wt.run(); executor.execute(wt); frames++; } executor.shutdown(); end_ms = System.currentTimeMillis() / 1000L; System.out.println("Frame Rate :" + frames / ((end_ms - start_ms))); raf.close(); } if (cmd.hasOption("ss") && !cmd.getOptionValue("o").matches("-")) { RandomAccessFile raf = new RandomAccessFile(cmd.getOptionValue("o"), "rw"); // RandomAccessFile ra = new RandomAccessFile(cmd.getOptionValue("o"), "rw"); // MappedByteBuffer raf = new RandomAccessFile(cmd.getOptionValue("o"), "rw").getChannel().map(FileChannel.MapMode.READ_WRITE, 0, ((width*height)+(width*height/2))*frame); ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newCachedThreadPool(); while ((nRead = if1.read(data)) != -1 && ((fRead = if2.read(data1)) != -1) && frames < frame) { byte[] data_out = data.clone(); byte[] data1_out = data1.clone(); SidebySideImageThread wt = new SidebySideImageThread(data_out, data1_out, frames, width, height, raf); // MPSidebySideImageThread wt = new MPSidebySideImageThread(data_out, data1_out, frames, width, height, ra); frames++; // wt.run(); executor.execute(wt); } executor.shutdown(); end_ms = System.currentTimeMillis() / 1000L; while (!executor.isTerminated()) { } raf.close(); } if (cmd.hasOption("ss") && cmd.getOptionValue("o").matches("-")) { PrintStream stdout = new PrintStream(System.out); // RandomAccessFile ra = new RandomAccessFile(cmd.getOptionValue("o"), "rw"); // MappedByteBuffer raf = new RandomAccessFile(cmd.getOptionValue("o"), "rw").getChannel().map(FileChannel.MapMode.READ_WRITE, 0, ((width*height)+(width*height/2))*frame); // ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newCachedThreadPool(); while ((nRead = if1.read(data)) != -1 && ((fRead = if2.read(data1)) != -1) && frames < frame) { byte[] data_out = data.clone(); byte[] data1_out = data1.clone(); SidebySideImageThread wt = new SidebySideImageThread(data_out, data1_out, frames, width, height, stdout); // MPSidebySideImageThread wt = new MPSidebySideImageThread(data_out, data1_out, frames, width, height, ra); frames++; // wt.run(); wt.run(); } end_ms = System.currentTimeMillis() / 1000L; System.out.println("Frame Rate :" + frames / ((end_ms - start_ms))); stdout.close(); } if (cmd.hasOption("image")) { System.setProperty("java.awt.headless", "true"); //ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newCachedThreadPool(); ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(10); while ((nRead = if1.read(data)) != -1 && ((fRead = if2.read(data1)) != -1)) { if (frames == frame) { byte[] data_out = data.clone(); byte[] data1_out = data1.clone(); Frame f1 = new Frame(data_out, width, height, Frame.YUV420); Frame f2 = new Frame(data1_out, width, height, Frame.YUV420); // System.out.println(cmd.getOptionValue("o")); ExtractImageThread wt = new ExtractImageThread(f1, frames, cmd.getOptionValue("if1") + "frame1-" + cmd.getOptionValue("o")); ExtractImageThread wt1 = new ExtractImageThread(f2, frames, cmd.getOptionValue("if2") + "frame2-" + cmd.getOptionValue("o")); // executor.execute(wt); executor.execute(wt); executor.execute(wt1); } frames++; } executor.shutdown(); // executor.shutdown(); end_ms = System.currentTimeMillis() / 1000L; System.out.println("Frame Rate :" + frames / ((end_ms - start_ms))); } } catch (ParseException ex) { Logger.getLogger(MediaTool.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:org.pegadi.client.ApplicationLauncher.java
public static void main(String[] args) { com.sun.net.ssl.internal.ssl.Provider provider = new com.sun.net.ssl.internal.ssl.Provider(); java.security.Security.addProvider(provider); setAllPermissions();//from w w w. j a va2s. com /** * If we are on Apples operating system, we would like to use the screen * menu bar It is the first property we set in our main method. This is * to make sure that the property is set before awt is loaded. */ if (System.getProperty("os.name").toLowerCase().startsWith("mac os x")) { System.setProperty("apple.laf.useScreenMenuBar", "true"); } Logger log = LoggerFactory.getLogger(ApplicationLauncher.class); /** * Making sure default L&F is System */ if (!UIManager.getLookAndFeel().getName().equals(UIManager.getSystemLookAndFeelClassName())) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { log.warn("Unable to change L&F to System", e); } } long start = System.currentTimeMillis(); // Splash Splash splash = new Splash("/images/splash.png"); splash.setVisible(true); splash.setCursor(new Cursor(Cursor.WAIT_CURSOR)); if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); } ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "org/pegadi/client/client-context.xml"); closeContextOnShutdown(context); long timeToLogin = System.currentTimeMillis() - start; log.info("Connected OK after {} ms", timeToLogin); log.info("Java Version {}", System.getProperty("java.version")); splash.dispose(); }
From source file:com.github.lucapino.sheetmaker.PreviewJFrame.java
public static void main(String[] args) { System.setProperty("awt.useSystemAAFontSettings", "on"); System.setProperty("swing.aatext", "true"); SwingUtilities.invokeLater(new Runnable() { @Override//from w w w . j a v a 2s. c o m public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); File tmpFolder = new File("/tmp/images"); tmpFolder.mkdir(); String coverPath = tmpFolder.getAbsolutePath().replaceAll("\\\\", "/") + "/cover.jpg"; String backdropPath = tmpFolder.getAbsolutePath().replaceAll("\\\\", "/") + "/backdrop.jpg"; String fanart1Path = tmpFolder.getAbsolutePath().replaceAll("\\\\", "/") + "/fanart1.jpg"; String fanart2Path = tmpFolder.getAbsolutePath().replaceAll("\\\\", "/") + "/fanart2.jpg"; String fanart3Path = tmpFolder.getAbsolutePath().replaceAll("\\\\", "/") + "/fanart3.jpg"; PreviewJFrame frame = new PreviewJFrame(); logger.info("Creating parser..."); InfoRetriever parser = new MediaInfoRetriever(); MovieInfo movieInfo = parser.getMovieInfo("/media/tagliani/Elements/Film/JackRyan.mkv"); logger.info("Retrieving movie file info..."); logger.info("Creating dataretriever..."); DataRetriever retriever = new DataRetrieverImpl(); logger.info("Retrieving movie data..."); Movie movie = retriever.retrieveMovieFromImdbID("tt1205537", "IT"); logger.info("Retrieving backdrops and fanart..."); List<Artwork> images = movie.getBackdrops(); // background logger.info("Saving backdrop..."); IOUtils.copyLarge(new URL(images.get(0).getImageURL()).openStream(), new FileOutputStream(backdropPath)); for (int i = 1; i < 4; i++) { // fanart1 // fanart2 // fanart3 String imageURL = images.get(i).getImageURL(); logger.info("Saving fanart{}...", i); IOUtils.copyLarge(new URL(imageURL).openStream(), new FileOutputStream(tmpFolder.getAbsolutePath() + "/fanart" + i + ".jpg")); } // cover logger.info("Retrieving cover..."); Artwork cover = movie.getPosters().get(0); String imageURL = cover.getImageURL(); logger.info("Saving cover..."); IOUtils.copyLarge(new URL(imageURL).openStream(), new FileOutputStream(coverPath)); Map<String, String> tokenMap = TemplateFilter.createTokenMap(movie, movieInfo, null); logger.info("Creating renderer..."); JavaTemplateRenderer renderer = new JavaTemplateRenderer(); JPanel imagePanel = null; try { logger.info("Rendering image..."); imagePanel = renderer.renderTemplate( this.getClass().getResource("/templates/simplicity/template.xml"), tokenMap, backdropPath, fanart1Path, fanart2Path, fanart3Path, coverPath); logger.info("Adding image to frame..."); frame.add(imagePanel); } catch (Exception ex) { ex.printStackTrace(); } imagePanel.setPreferredSize(new Dimension(imagePanel.getWidth(), imagePanel.getHeight())); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setVisible(true); frame.pack(); logger.info("Creating image for save..."); BufferedImage imageTosave = ScreenImage.createImage(imagePanel); logger.info("Saving image..."); ScreenImage.writeImage(imageTosave, "/tmp/images/final.png"); logger.info("Image saved..."); } catch (Exception ex) { logger.error("Error: ", ex); } } }); }
From source file:ca.uhn.hl7v2.sourcegen.SourceGenerator.java
public static void main(String[] args) throws ClassNotFoundException, HL7Exception { Class.forName("com.mysql.jdbc.Driver"); System.setProperty("ca.on.uhn.hl7.database.url", "jdbc:mysql://localhost:3306/hl7v65"); System.setProperty("ca.on.uhn.hl7.database.user", "hl7"); System.setProperty("ca.on.uhn.hl7.database.password", "hl7"); makeAll("tmp", "2.5.1", true, "", "java"); }
From source file:com.marklogic.client.functionaltest.JavaApiBatchSuite.java
/** * This class is for the .Net IKVM port of the junit tests. * * @param args//from w w w . j a v a 2 s. co m * The args */ public static void main(String[] args) { System.setProperty("REST.host", "localhost"); System.setProperty("REST.port", "8013"); System.setProperty("REST.user", "rest-admin"); System.setProperty("xcc.pass", "x"); createRESTUser("rest-admin", "x", "rest-admin"); createRESTUser("rest-writer", "x", "rest-writer"); createRESTUser("rest-reader", "x", "rest-reader"); createRESTAppServer("JavaClientApiDefault", 8013); createRESTSSLAppServer("JavaClientApiDefaultSSL", 8014); for (Class testclass : testClasses) { System.out.println("Starting the Test: " + testclass); runTestCase(testclass); } deleteRESTAppServerWithDB("JavaClientApiDefault"); deleteRESTAppServerWithDB("JavaClientApiDefaultSSL"); }