문제

I've a created an standalone application in which my aim is to execute a command(with arguments Eg: gedit filename). How to do this through java programming. I tried the following piece of code, but its not working.

String[] command = new String[]{"gedit", "abc"};  
Process child = Runtime.getRuntime().exec(command);  

I've tried all sorts of combinations on the exec() command and also used JavaProcessBuilder many times but I seem to get no solution for this. Can anyone please help me with this. Please try to give the code, I've already visited many links but all in vain. Please help.
-Thanks in advance

도움이 되었습니까?

해결책

You need to provide the full qualified path to gedit (e.g /home/user/bin/gedit)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top