How to run linux command using Java Swing using onClick event? -
i want create application provides gui using java swing in application need use terminal execute commands of linux ubuntu os sudo apt-get update , other.
is there method or code executes command in terminal in background when click on button (on-click event) in form built using java swing?
you can use processbuilder class used 1 of projects execute commands in linux(fedora 18) execute particular process.
processbuilder pb = new processbuilder("ls"); process p = pb.start(); p.waitfor();// wait untill execution complets;
Comments
Post a Comment