Example usage for java.lang System getProperty

List of usage examples for java.lang System getProperty

Introduction

In this page you can find the example usage for java.lang System getProperty.

Prototype

public static String getProperty(String key) 

Source Link

Document

Gets the system property indicated by the specified key.

Usage

From source file:com.bfair.pricing.main.AmqpPricingApplication.java

public static void main(String[] args) throws Exception {
    SpringApplication.run("classpath:server-bootstrap-config.xml", args);
    System.out.println("Logging to " + System.getProperty("java.io.tmpdir"));
}

From source file:EditComboBox.java

public static void main(String args[]) {
    String labels[] = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" };
    JFrame frame = new JFrame("Editable JComboBox");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container contentPane = frame.getContentPane();

    final JComboBox comboBox = new JComboBox(labels);
    comboBox.setMaximumRowCount(5);/*from   ww w .  j  a va  2s  . c o m*/
    comboBox.setEditable(true);
    contentPane.add(comboBox, BorderLayout.NORTH);

    final JTextArea textArea = new JTextArea();
    JScrollPane scrollPane = new JScrollPane(textArea);
    contentPane.add(scrollPane, BorderLayout.CENTER);

    ActionListener actionListener = new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            textArea.append("Selected: " + comboBox.getSelectedItem());
            textArea.append(", Position: " + comboBox.getSelectedIndex());
            textArea.append(System.getProperty("line.separator"));
        }
    };
    comboBox.addActionListener(actionListener);

    frame.setSize(300, 200);
    frame.setVisible(true);
}

From source file:com.vaadin.buildhelpers.FetchReleaseNotesTickets.java

public static void main(String[] args) throws IOException {
    String version = System.getProperty("vaadin.version");
    if (version == null || version.equals("")) {
        usage();//  ww w . java  2s  .  c o m
    }

    URL url = new URL(queryURL.replace("@version@", version));
    URLConnection connection = url.openConnection();
    InputStream urlStream = connection.getInputStream();

    @SuppressWarnings("unchecked")
    List<String> tickets = IOUtils.readLines(urlStream);

    for (String ticket : tickets) {
        String[] fields = ticket.split("\t");
        if ("id".equals(fields[0])) {
            // This is the header
            continue;
        }
        System.out.println(ticketTemplate.replace("@ticket@", fields[0]).replace("@description@", fields[1]));
    }
    urlStream.close();
}

From source file:com.clustercontrol.winsyslog.HinemosWinSyslogMain.java

public static void main(String[] args) {
    try {//w w  w .  j av  a2 s . c  om
        log.info("receiver started.");

        // ??
        String etcDir = System.getProperty("hinemos.manager.etc.dir");
        String configFilePath = new File(etcDir, "syslog.conf").getAbsolutePath();
        WinSyslogConfig.init(configFilePath);

        // Sender?
        String targetValue = WinSyslogConfig.getProperty("syslog.send.targets");
        log.info("Sender initialise." + " (target=" + targetValue + ")");
        UdpSender.init(targetValue);

        // Receiver
        boolean tcpEnable = WinSyslogConfig.getBooleanProperty("syslog.receive.tcp");
        boolean udpEnable = WinSyslogConfig.getBooleanProperty("syslog.receive.udp");
        int port = WinSyslogConfig.getIntegerProperty("syslog.receive.port");
        log.info("Receiver starting." + " (tcpEnable=" + tcpEnable + ", udpEnable=" + udpEnable + ", port="
                + port + ")");

        receiver = new SyslogReceiver(tcpEnable, udpEnable, port);
        receiver.start();

        Runtime.getRuntime().addShutdownHook(new Thread() {
            @Override
            public void run() {
                synchronized (shutdownLock) {
                    receiver.shutdown();

                    shutdown = true;
                    shutdownLock.notify();
                }
            }
        });

        synchronized (shutdownLock) {
            while (!shutdown) {
                try {
                    shutdownLock.wait();
                } catch (InterruptedException e) {
                    log.warn("shutdown lock interrupted.", e);
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException sleepE) {
                    }
                    ;
                }
            }
        }

        System.exit(0);
    } catch (Exception e) {
        log.error("unknown error.", e);
    }
}

From source file:com.chargebee.CSV.RemovingDuplicateEntries.java

public static void main(String[] args) throws IOException, Exception {
    String source = System.getProperty("user.home") + "/input.csv";
    String output = System.getProperty("user.home") + "/output.csv";

    RemovingDuplicateEntries rde = new RemovingDuplicateEntries();

    CSVParser parser = MethodBank.parserInitializer(source);
    CSVPrinter printer = MethodBank.printerInitializer(output);

    rde.remove(parser, printer);//from w ww  . j a  va  2  s. c o  m
    parser.close();
    printer.close();

}

From source file:com.easyway.spring.apache.chat.SpringMain.java

public static void main(String[] args) throws Exception {
    if (System.getProperty("com.sun.management.jmxremote") != null) {
        System.out.println("JMX enabled.");
    } else {// w w w.  j a va2s.  c  o m
        System.out.println("JMX disabled. Please set the "
                + "'com.sun.management.jmxremote' system property to enable JMX.");
    }
    getApplicationContext();
    System.out.println("Listening ...");
}

From source file:com.bright.utils.rmDuplicateLines.java

public static void main(String args) {
    File monfile = new File(args);

    Set<String> userIdSet = new LinkedHashSet<String>();

    if (monfile.isFile() && monfile.getName().endsWith(".txt")) {
        try {//from   www.j  a v  a  2  s  .co  m
            List<String> content = FileUtils.readLines(monfile, Charset.forName("UTF-8"));
            userIdSet.addAll(content);

            Iterator<String> itr = userIdSet.iterator();
            StringBuffer output = new StringBuffer();
            while (itr.hasNext()) {

                output.append(itr.next() + System.getProperty("line.separator"));

            }

            BufferedWriter out = new BufferedWriter(new FileWriter(monfile));
            String outText = output.toString();

            out.write(outText);

            out.close();
        } catch (IOException e) {
            e.printStackTrace();

        }
    }

}

From source file:examples.ssh.SFTPUpload.java

public static void main(String[] args) throws Exception {
    SSHClient ssh = new SSHClient();
    ssh.loadKnownHosts();/*ww  w. j  a v  a  2s .  com*/
    ssh.connect("localhost");
    try {
        ssh.authPublickey(System.getProperty("user.name"));
        ssh.newSFTPClient().put("/Users/shikhar/well", "/tmp/");
    } finally {
        ssh.disconnect();
    }
}

From source file:examples.ssh.SFTPDownload.java

public static void main(String[] args) throws Exception {
    SSHClient ssh = new SSHClient();
    ssh.loadKnownHosts();//w w w  . ja v  a  2  s.c o  m
    ssh.connect("localhost");
    try {
        ssh.authPublickey(System.getProperty("user.name"));
        ssh.newSFTPClient().get("well", "/tmp/");
    } finally {
        ssh.disconnect();
    }
}

From source file:examples.ssh.SCPUpload.java

public static void main(String[] args) throws Exception {
    SSHClient ssh = new SSHClient();
    ssh.loadKnownHosts();/*from  w  w w.  java  2s  .  c o  m*/
    ssh.connect("localhost");
    try {
        ssh.authPublickey(System.getProperty("user.name"));

        // Compression = significant speedup for large file transfers on fast links
        // present here to demo algorithm renegotiation - could have just put this before connect()
        ssh.useCompression();

        ssh.newSCPFileTransfer().upload("/Users/shikhar/well", "/tmp/");
    } finally {
        ssh.disconnect();
    }
}