I'm working on a Java desktop aplication to manage iptables and i want to execute iptables commands via Java, this is what i am doing:
i execute from terminal gksu "iptables -L" and it worked but when i try to execute it from Java runtime ( exec.("gksu \"iptables -L\" ") ) i keep getting this output:
GKsu version 2.0.2
Usage: gksu [-u ] [options]
Print information on the screen that might be useful for diagnosing and/or solving problems.
--user , -u
Call <command> as the specified user.
Disable the "locking" of the keyboard, mouse, and focus done by the program when asking for password.
Ask the user if they want to have their keyboard and mouse grabbed before doing so.
Preserve the current environments, does not set $HOME nor $PATH, for example.
Make this a login shell. Beware this may cause problems with the Xauthority magic. Run xhost to allow the target user to open windows on your display!
--description , -D
Provide a descriptive name for the command to be used in the default message, making it nicer. You can also provide the absolute path for a .desktop file. The Name key for will be used in this case.
--message , -m
Replace the standard message shown to ask for password for the argument passed to the option. Only use this if --description does not suffice.
Ask gksu to print the password to stdout, just like ssh-askpass. Useful to use in scripts with programs that accept receiving the password on stdin.
Make GKSu use sudo instead of su, as if it had been run as "gksudo".
Make GKSu use su, instead of using libgksu's default.
I hope someone can help me :D plox :P