how to run super user commands in java? -


i running 1 (runtime)sample java program in ide. not getting in console.

the program execute super user commands.

 try { process p = runtime.getruntime().exec("su -c xl list");  // or "sudo xl list" bufferedreader in = new bufferedreader(                                 new inputstreamreader(p.getinputstream())); string line = null; while ((line = in.readline()) != null) {                 system.out.println(line); } } catch (ioexception e) { e.printstacktrace();     } 

^ xl list super user command.

how call one. or give me suggestion call "ipconfig" command.

perhaps getting error, or su asking password

i suggest you

  • read error messages
  • using sudo in way doesn't require password.

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -