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

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -