You must quote the argument to
mkdir
, otherwisesu
will assume that/system/test
is a user name and fail to run.Process process = Runtime.getRuntime().exec("su -c \"mkdir /path/to/test\"");
Some areas of the filesystem, such as
/system
, are read only due to the way the filesystem is organized/mounted. Root access won't change that, your command will still fail.
To verify whether what you're trying to do is possible, install a terminal emulator on the device and run the command by hand first.