Example usage for java.lang System in

List of usage examples for java.lang System in

Introduction

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

Prototype

InputStream in

To view the source code for java.lang System in.

Click Source Link

Document

The "standard" input stream.

Usage

From source file:it.geosolutions.sfs.web.Start.java

public static void main(String[] args) {
    final Server jettyServer = new Server();

    try {/*from   ww w . j  av  a2  s  .  co  m*/
        SocketConnector conn = new SocketConnector();
        String portVariable = System.getProperty("jetty.port");
        int port = parsePort(portVariable);
        if (port <= 0)
            port = 8082;
        conn.setPort(port);
        conn.setAcceptQueueSize(100);
        conn.setMaxIdleTime(1000 * 60 * 60);
        conn.setSoLingerTime(-1);

        // Use this to set a limit on the number of threads used to respond requests
        // BoundedThreadPool tp = new BoundedThreadPool();
        // tp.setMinThreads(8);
        // tp.setMaxThreads(8);
        // conn.setThreadPool(tp);

        // SSL host name given ?
        String sslHost = System.getProperty("ssl.hostname");
        SslSocketConnector sslConn = null;
        //            if (sslHost!=null && sslHost.length()>0) {   
        //                Security.addProvider(new BouncyCastleProvider());
        //                sslConn = getSslSocketConnector(sslHost);
        //            }

        if (sslConn == null) {
            jettyServer.setConnectors(new Connector[] { conn });
        } else {
            conn.setConfidentialPort(sslConn.getPort());
            jettyServer.setConnectors(new Connector[] { conn, sslConn });
        }

        /*Constraint constraint = new Constraint();
        constraint.setName(Constraint.__BASIC_AUTH);;
        constraint.setRoles(new String[]{"user","admin","moderator"});
        constraint.setAuthenticate(true);
                 
        ConstraintMapping cm = new ConstraintMapping();
        cm.setConstraint(constraint);
        cm.setPathSpec("/*");
                
        SecurityHandler sh = new SecurityHandler();
        sh.setUserRealm(new HashUserRealm("MyRealm","/Users/jdeolive/realm.properties"));
        sh.setConstraintMappings(new ConstraintMapping[]{cm});
                
        WebAppContext wah = new WebAppContext(sh, null, null, null);*/
        WebAppContext wah = new WebAppContext();
        wah.setContextPath("/sfs");
        wah.setWar("src/main/webapp");

        jettyServer.setHandler(wah);
        wah.setTempDirectory(new File("target/work"));
        //this allows to send large SLD's from the styles form
        wah.getServletContext().getContextHandler().setMaxFormContentSize(1024 * 1024 * 2);

        String jettyConfigFile = System.getProperty("jetty.config.file");
        if (jettyConfigFile != null) {
            //                log.info("Loading Jetty config from file: " + jettyConfigFile);
            (new XmlConfiguration(new FileInputStream(jettyConfigFile))).configure(jettyServer);
        }

        jettyServer.start();

        /*
         * Reads from System.in looking for the string "stop\n" in order to gracefully terminate
         * the jetty server and shut down the JVM. This way we can invoke the shutdown hooks
         * while debugging in eclipse. Can't catch CTRL-C to emulate SIGINT as the eclipse
         * console is not propagating that event
         */
        Thread stopThread = new Thread() {
            @Override
            public void run() {
                BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
                String line;
                try {
                    while (true) {
                        line = reader.readLine();
                        if ("stop".equals(line)) {
                            jettyServer.stop();
                            System.exit(0);
                        }
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        };
        stopThread.setDaemon(true);
        stopThread.run();

        // use this to test normal stop behaviour, that is, to check stuff that
        // need to be done on container shutdown (and yes, this will make 
        // jetty stop just after you started it...)
        // jettyServer.stop(); 
    } catch (Exception e) {
        //            log.log(Level.SEVERE, "Could not start the Jetty server: " + e.getMessage(), e);

        if (jettyServer != null) {
            try {
                jettyServer.stop();
            } catch (Exception e1) {
                //                    log.log(Level.SEVERE,
                //                        "Unable to stop the " + "Jetty server:" + e1.getMessage(), e1);
            }
        }
    }
}

From source file:com.yahoo.semsearch.fastlinking.EntityContextFastEntityLinker.java

/**
 * Context-aware command line entity linker
 * @param args arguments (see -help for further info)
 * @throws Exception/* ww  w  .j  a  va 2  s  .c o  m*/
 */
public static void main(String args[]) throws Exception {
    SimpleJSAP jsap = new SimpleJSAP(EntityContextFastEntityLinker.class.getName(),
            "Interactive mode for entity linking",
            new Parameter[] {
                    new FlaggedOption("hash", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, 'h', "hash",
                            "quasi succint hash"),
                    new FlaggedOption("vectors", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, 'v',
                            "vectors", "Word vectors file"),
                    new FlaggedOption("labels", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'l',
                            "labels", "File containing query2entity labels"),
                    new FlaggedOption("id2type", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'i',
                            "id2type", "File with the id2type mapping"),
                    new Switch("centroid", 'c', "centroid", "Use centroid-based distances and not LR"),
                    new FlaggedOption("map", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'm', "map",
                            "Entity 2 type mapping "),
                    new FlaggedOption("threshold", JSAP.STRING_PARSER, "-20", JSAP.NOT_REQUIRED, 'd',
                            "threshold", "Score threshold value "),
                    new FlaggedOption("entities", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, 'e',
                            "entities", "Entities word vectors file"), });

    JSAPResult jsapResult = jsap.parse(args);
    if (jsap.messagePrinted())
        return;

    double threshold = Double.parseDouble(jsapResult.getString("threshold"));
    QuasiSuccinctEntityHash hash = (QuasiSuccinctEntityHash) BinIO.loadObject(jsapResult.getString("hash"));
    EntityContext queryContext;
    if (!jsapResult.getBoolean("centroid")) {
        queryContext = new LREntityContext(jsapResult.getString("vectors"), jsapResult.getString("entities"),
                hash);
    } else {
        queryContext = new CentroidEntityContext(jsapResult.getString("vectors"),
                jsapResult.getString("entities"), hash);
    }
    HashMap<String, ArrayList<EntityRelevanceJudgment>> labels = null;
    if (jsapResult.getString("labels") != null) {
        labels = readTrainingData(jsapResult.getString("labels"));
    }

    String map = jsapResult.getString("map");

    HashMap<String, String> entities2Type = null;

    if (map != null)
        entities2Type = readEntity2IdFile(map);

    EntityContextFastEntityLinker linker = new EntityContextFastEntityLinker(hash, queryContext);

    final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String q;
    for (;;) {
        System.out.print(">");
        q = br.readLine();
        if (q == null) {
            System.err.println();
            break; // CTRL-D
        }
        if (q.length() == 0)
            continue;
        long time = -System.nanoTime();
        try {
            List<EntityResult> results = linker.getResults(q, threshold);
            //List<EntityResult> results = linker.getResultsGreedy( q, 5 );
            //int rank = 0;

            for (EntityResult er : results) {
                if (entities2Type != null) {
                    String name = er.text.toString().trim();
                    String newType = entities2Type.get(name);
                    if (newType == null)
                        newType = "NF";
                    System.out.println(q + "\t span: \u001b[1m [" + er.text + "] \u001b[0m eId: " + er.id
                            + " ( t= " + newType + ")" + "  score: " + er.score + " ( " + er.s.span + " ) ");

                    //System.out.println( newType + "\t" + q + "\t" + StringUtils.remove( q, er.s.span.toString() ) + " \t " + er.text );
                    break;
                    /* } else {
                       System.out.print( "[" + er.text + "(" + String.format("%.2f",er.score) +")] ");
                    System.out.println( "span: \u001b[1m [" + er.text + "] \u001b[0m eId: " + er.id + " ( t= " + typeMapping.get( hash.getEntity( er.id ).type )
                    + "  score: " + er.score + " ( " + er.s.span + " ) " );
                    }
                    rank++;
                    */
                } else {
                    if (labels == null) {
                        System.out.println(q + "\t" + er.text + "\t" + er.score);
                    } else {
                        ArrayList<EntityRelevanceJudgment> jds = labels.get(q);
                        String label = "NF";
                        if (jds != null) {
                            EntityRelevanceJudgment relevanceOfEntity = relevanceOfEntity(er.text, jds);
                            label = relevanceOfEntity.label;
                        }
                        System.out.println(q + "\t" + er.text + "\t" + label + "\t" + er.score);
                        break;
                    }
                }
                System.out.println();
            }
            time += System.nanoTime();
            System.out.println("Time to rank and print the candidates:" + time / 1000000. + " ms");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

From source file:com.example.geomesa.lambda.LambdaQuickStart.java

public static void main(String[] args) throws Exception {
    Map<String, String> params = parseOptions(args);
    if (params == null) {
        System.exit(1);/*from   w w w  . j a v  a 2  s  .co m*/
    } else {
        try {
            new LambdaQuickStart(params, System.out, System.in).run();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(2);
        }
        System.exit(0);
    }
}

From source file:lapispaste.Main.java

public static void main(String[] args) throws Exception {
    // create Options object
    Options options = new Options();
    String version;//from ww  w .j a v  a 2s. c  o m

    version = "0.1";

    // populate Options with.. well options :P
    options.addOption("v", false, "Display version");
    options.addOption("f", true, "File to paste");

    // non-critical options
    options.addOption("t", true, "Code language");
    options.addOption("p", false, "Read from pipe");

    CommandLineParser parser = new PosixParser();
    CommandLine cmd = parser.parse(options, args);

    // assemble a map of values
    final Map<String, String> pastemap = new HashMap<String, String>();

    if (cmd.hasOption("t"))
        pastemap.put("format", cmd.getOptionValue("t").toString());
    else
        pastemap.put("format", "text");

    // critical options
    if (cmd.hasOption("v"))
        System.out.println("lapispaste version " + version);
    else if (cmd.hasOption("f")) {
        File file = new File(cmd.getOptionValue("f"));
        StringBuffer pdata = readData(new FileReader(file));
        paster(pastemap, pdata);
    } else if (cmd.hasOption("p")) {
        StringBuffer pdata = readData(new InputStreamReader(System.in));
        paster(pastemap, pdata);
    } else {
        // Did not recieve what was expected
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("lapispaste [OPTIONS] [FILE]", options);
    }

}

From source file:com.ibm.watson.app.common.tools.services.classifier.TrainClassifier.java

public static void main(String[] args) throws Exception {
    Option urlOption = createOption(URL_OPTION, URL_OPTION_LONG, true,
            "The absolute URL of the NL classifier service to connect to. If omitted, the default will be used ("
                    + DEFAULT_URL + ")",
            false, "url");
    Option usernameOption = createOption(USERNAME_OPTION, USERNAME_OPTION_LONG, true,
            "The username to use during authentication to the NL classifier service", true, "username");
    Option passwordOption = createOption(PASSWORD_OPTION, PASSWORD_OPTION_LONG, true,
            "The password to use during authentication to the NL classifier service", true, "password");
    Option fileOption = createOption(FILE_OPTION, FILE_OPTION_LONG, true,
            "The filepath to be used as training data", false, "file");
    Option deleteOption = createOption(DELETE_OPTION, DELETE_OPTION_LONG, false,
            "If specified, the classifier instance will be deleted if training is not successful");

    final Options options = buildOptions(urlOption, usernameOption, passwordOption, fileOption, deleteOption);

    CommandLine cmd;/*from www .j a va  2  s  .co  m*/
    try {
        CommandLineParser parser = new GnuParser();
        cmd = parser.parse(options, args);
    } catch (ParseException e) {
        System.err.println(MessageKey.AQWEGA14016E_could_not_parse_cmd_line_args_1.getMessage(e.getMessage())
                .getFormattedMessage());
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(120, "java " + TrainClassifier.class.getName(), null, options, null);
        return;
    }

    final String url = cmd.hasOption(URL_OPTION) ? cmd.getOptionValue(URL_OPTION) : DEFAULT_URL;
    final String username = cmd.getOptionValue(USERNAME_OPTION).trim();
    final String password = cmd.getOptionValue(PASSWORD_OPTION).trim();

    if (username.isEmpty() || password.isEmpty()) {
        throw new IllegalArgumentException(
                MessageKey.AQWEGA14014E_username_and_password_cannot_empty.getMessage().getFormattedMessage());
    }

    final NLClassifierRestClient client = new NLClassifierRestClient(url, username, password);

    listClassifiers(client);
    System.out.println(MessageKey.AQWEGA10012I_h_help.getMessage().getFormattedMessage());

    String userInput;
    boolean exit = false;
    NLClassifier classifier = null;
    boolean isTraining = false;

    if (cmd.hasOption(FILE_OPTION)) {
        // File option was specified, go directly to training
        classifier = train(client, cmd.getOptionValue(FILE_OPTION));
        isTraining = true;
    }

    try (final Scanner scanner = new Scanner(System.in)) {
        while (!exit) {
            System.out.print("> ");
            userInput = scanner.nextLine().trim();

            if (userInput.equals("q") || userInput.equals("quit") || userInput.equals("exit")) {
                exit = true;
            } else if (userInput.equals("h") || userInput.equals("help")) {
                printHelp();
            } else if (userInput.equals("l") || userInput.equals("list")) {
                listClassifiers(client);
            } else if (userInput.equals("t") || userInput.equals("train")) {
                if (!isTraining) {
                    System.out.print("Enter filename: ");
                    String filename = scanner.nextLine().trim();
                    classifier = train(client, filename);
                    isTraining = true;
                } else {
                    System.err.println(MessageKey.AQWEGA10013I_t_cannot_used_during_training.getMessage()
                            .getFormattedMessage());
                }
            } else if (userInput.equals("s") || userInput.equals("status")) {
                if (isTraining) {
                    exit = getStatus(client, classifier, cmd.hasOption(DELETE_OPTION));
                } else {
                    System.err.println(MessageKey.AQWEGA10014I_s_can_used_during_training.getMessage()
                            .getFormattedMessage());
                }
            } else if (userInput.equals("c") || userInput.equals("classify")) {
                if (classifier != null && classifier.getStatus().equals(Status.AVAILABLE)) {
                    isTraining = false;
                    System.out.print(MessageKey.AQWEGA10015I_text_classify.getMessage().getFormattedMessage());
                    String text = scanner.nextLine().trim();
                    classify(client, classifier, text);
                } else {
                    System.err.println(MessageKey.AQWEGA10016I_c_can_used_after_training_has_completed
                            .getMessage().getFormattedMessage());
                }
            } else {
                System.err.println(
                        MessageKey.AQWEGA14017E_unknown_command_1.getMessage(userInput).getFormattedMessage());
            }
            Thread.sleep(100); // Give the out / err consoles time to battle it out before printing the command prompt
        }
    }
}

From source file:com.benchmark.TikaCLI.java

public static void main(String[] args) throws Exception {
    //        BasicConfigurator.configure(
    //                new WriterAppender(new SimpleLayout(), System.err));
    //        Logger.getRootLogger().setLevel(Level.INFO);

    TikaCLI cli = new TikaCLI();
    if (args.length > 0) {
        for (int i = 0; i < args.length; i++) {
            cli.process(args[i]);/*from w ww  .  j  a v a 2s  .  c  o m*/
        }
        if (cli.pipeMode) {
            cli.process("-");
        }
    } else {
        // Started with no arguments. Wait for up to 0.1s to see if
        // we have something waiting in standard input and use the
        // pipe mode if we have. If no input is seen, start the GUI.
        if (System.in.available() == 0) {
            Thread.sleep(100);
        }
        if (System.in.available() > 0) {
            cli.process("-");
        } else {
            cli.process("--gui");
        }
    }
}

From source file:de.dominicscheurer.passwords.Main.java

/**
 * @param args/*ww w . ja  v a  2  s  . c om*/
 *            Command line arguments (see code or output of program when
 *            started with no arguments).
 */
@SuppressWarnings("static-access")
public static void main(String[] args) {
    Options options = new Options();

    Option seedPwdOpt = OptionBuilder.withArgName("Seed Password").isRequired().hasArg()
            .withDescription("Password used as a seed").withLongOpt("seed-password").create("s");

    Option serviceIdOpt = OptionBuilder.withArgName("Service Identifier").isRequired().hasArg()
            .withDescription("The service that the password is created for, e.g. facebook.com")
            .withLongOpt("service-identifier").create("i");

    Option pwdLengthOpt = OptionBuilder.withArgName("Password Length").withType(Integer.class).hasArg()
            .withDescription("Length of the password in characters").withLongOpt("pwd-length").create("l");

    Option specialChars = OptionBuilder.withArgName("With special chars (TRUE|false)").withType(Boolean.class)
            .hasArg().withDescription("Set to true if special chars !-_?=@/+* are desired, else false")
            .withLongOpt("special-chars").create("c");

    Option suppressPwdOutpOpt = OptionBuilder
            .withDescription("Suppress password output (copy to clipboard only)").withLongOpt("hide-password")
            .hasArg(false).create("x");

    Option helpOpt = OptionBuilder.withDescription("Prints this help message").withLongOpt("help").create("h");

    options.addOption(seedPwdOpt);
    options.addOption(serviceIdOpt);
    options.addOption(pwdLengthOpt);
    options.addOption(specialChars);
    options.addOption(suppressPwdOutpOpt);
    options.addOption(helpOpt);

    CommandLineParser parser = new GnuParser();
    try {
        CommandLine cmd = parser.parse(options, args);

        if (cmd.hasOption("h")) {
            SafePwdGen.printHelp(options);
            System.exit(0);
        }

        int pwdLength = STD_PWD_LENGTH;
        if (cmd.hasOption("l")) {
            pwdLength = new Integer(cmd.getOptionValue("l"));
        }

        boolean useSpecialChars = true;
        if (cmd.hasOption("c")) {
            useSpecialChars = new Boolean(cmd.getOptionValue("c"));
        }

        if (pwdLength > MAX_PWD_LENGTH_64 && !useSpecialChars) {
            System.out.println(PASSWORD_SIZE_TOO_BIG + MAX_PWD_LENGTH_64);
        }

        if (pwdLength > MAX_PWD_LENGTH_71 && useSpecialChars) {
            System.out.println(PASSWORD_SIZE_TOO_BIG + MAX_PWD_LENGTH_71);
        }

        boolean suppressPwdOutput = cmd.hasOption('x');

        String pwd = SafePwdGen.createPwd(cmd.getOptionValue("s"), cmd.getOptionValue("i"), pwdLength,
                useSpecialChars);

        if (!suppressPwdOutput) {
            System.out.print(GENERATED_PASSWORD);
            System.out.println(pwd);
        }
        System.out.println(CLIPBOARD_COPIED_MSG);
        SystemClipboardInterface.copy(pwd);

        System.in.read();
    } catch (ParseException e) {
        System.out.println(e.getLocalizedMessage());
        SafePwdGen.printHelp(options);
    } catch (UnsupportedEncodingException e) {
        System.out.println(e.getLocalizedMessage());
    } catch (NoSuchAlgorithmException e) {
        System.out.println(e.getLocalizedMessage());
    } catch (IOException e) {
        System.out.println(e.getLocalizedMessage());
    }
}

From source file:com.denimgroup.threadfix.importer.cli.CommandLineMigration.java

public static void main(String[] args) {

    if (!check(args))
        return;//w w  w  .  j  av a 2 s .  co m

    try {
        String inputScript = args[0];
        String inputMySqlConfig = args[1];
        String outputScript = "import.sql";
        String outputMySqlConfigTemp = "jdbc_temp.properties";
        String errorLogFile = "error.log";
        String fixedSqlFile = "error_sql.sql";
        String errorLogAttemp1 = "error1.log";
        String infoLogFile = "info.log";
        String rollbackScript = "rollback.sql";

        deleteFile(outputScript);
        deleteFile(errorLogFile);
        deleteFile(errorLogFile);
        deleteFile(fixedSqlFile);
        deleteFile(errorLogAttemp1);
        deleteFile(infoLogFile);
        deleteFile(rollbackScript);

        PrintStream infoPrintStream = new PrintStream(new FileOutputStream(new File(infoLogFile)));
        System.setOut(infoPrintStream);

        long startTime = System.currentTimeMillis();

        copyFile(inputMySqlConfig, outputMySqlConfigTemp);

        LOGGER.info("Creating threadfix table in mySql database ...");
        ScriptRunner scriptRunner = SpringConfiguration.getContext().getBean(ScriptRunner.class);

        startTime = printTimeConsumed(startTime);
        convert(inputScript, outputScript);

        startTime = printTimeConsumed(startTime);

        PrintStream errPrintStream = new PrintStream(new FileOutputStream(new File(errorLogFile)));
        System.setErr(errPrintStream);

        LOGGER.info("Sending sql script to MySQL server ...");
        scriptRunner.run(outputScript, outputMySqlConfigTemp);

        long errorCount = scriptRunner.checkRunningAndFixStatements(errorLogFile, fixedSqlFile);
        long lastCount = errorCount + 1;
        int times = 1;
        int sameFixedSet = 0;

        // Repeat
        while (errorCount > 0) {
            //Flush error log screen to other file
            errPrintStream = new PrintStream(new FileOutputStream(new File(errorLogAttemp1)));
            System.setErr(errPrintStream);

            times += 1;

            if (errorCount == lastCount) {
                sameFixedSet++;
            } else {
                sameFixedSet = 0;
            }

            LOGGER.info("Found " + errorCount + " error statements. Sending fixed sql script to MySQL server "
                    + times + " times ...");
            scriptRunner.run(fixedSqlFile, outputMySqlConfigTemp);
            lastCount = errorCount;
            errorCount = scriptRunner.checkRunningAndFixStatements(errorLogAttemp1, fixedSqlFile);

            if (errorCount > lastCount || sameFixedSet > SAME_SET_TRY_LIMIT)
                break;
        }

        if (errorCount > 0) {
            LOGGER.error("After " + times + " of trying, still found errors in sql script. "
                    + "Please check error_sql.sql and error1.log for more details.");
            LOGGER.info("Do you want to keep data in MySQL, and then import manually error statements (y/n)? ");
            try (java.util.Scanner in = new java.util.Scanner(System.in)) {
                String answer = in.nextLine();
                if (!answer.equalsIgnoreCase("y")) {
                    rollbackData(scriptRunner, outputMySqlConfigTemp, rollbackScript);
                } else {
                    LOGGER.info(
                            "Data imported to MySQL, but still have some errors. Please check error_sql.sql and error1.log to import manually.");
                }

            }

        } else {
            printTimeConsumed(startTime);
            LOGGER.info("Migration successfully finished");
        }

        deleteFile(outputMySqlConfigTemp);

    } catch (Exception e) {
        LOGGER.error("Error: ", e);
    }
}

From source file:citation_prediction.CitationCore.java

public static void main(String[] args) throws IOException {

    CitationCore.CitationCoreTest cct = new CitationCore().new CitationCoreTest(new Scanner(System.in));
    cct.run_user_tests();/*from  w ww.  ja v a  2 s .c  o  m*/
}

From source file:ch.ethz.dcg.jukefox.cli.CliJukefoxApplication.java

public static void main(String[] args) {

    CommandLineParser parser = new PosixParser();
    LogLevel logLevel = LogLevel.ERROR;/* w  ww.  ja v a2  s  .  co  m*/
    try {
        CommandLine line = parser.parse(getCliOptions(), args);
        if (line.hasOption(VERBOSE_OPTION)) {
            logLevel = LogLevel.VERBOSE;
        }
    } catch (ParseException e1) {
        Log.e(TAG, "Unexpected exception: " + e1.getMessage());
    }

    printWelcome();

    Log.setLogLevel(logLevel);

    // Send logs async
    new Thread(new Runnable() {

        @Override
        public void run() {
            playerModel.getLogManager().sendLogs();
        }
    }).start();

    CliJukefoxApplication application = new CliJukefoxApplication();

    try {
        scanner = new Scanner(System.in);
        application.start();

        ImportState importState = libraryImportManager.getImportState();
        importState.addListener(application);
        //System.out.println(importState.getProgress().getStatusMessage());

        while (running) {
            String next = scanner.nextLine();
            if (next.isEmpty()) {
                continue;
            }
            try {
                application.getCommandLineInterface().execute(next);
            } catch (ExecutionException e) {
                System.out.println("Invalid input, please use following commands: ");
                application.getCommandLineInterface().execute("help");
            }

        }
    } catch (ExecutionException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}