windows - running elasticsearch from java code -


i want run elastic search servlet. use method in servlet run elasticsearch not seem work.

ejbsessionbean.runcommand( "cmd c:\\elk\\elasticsearch\\bin\\elasticsearch";) 

the code runcommand follows:

  public  static void runcommand(string ch) throws ioexception {     if (ch.length() <= 0) {      system.err.println("need command run");    system.exit(-1);       }           runtime runtime = runtime.getruntime();    process process = runtime.exec(ch);    inputstream = process.getinputstream();    inputstreamreader isr = new inputstreamreader(is);    bufferedreader br = new bufferedreader(isr);    string line;     system.out.printf("output of running %s is:",         ch);     while ((line = br.readline()) != null) {      system.out.println(line);    } 

}


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -