java - How to add the environment variables to the android Runtime.getRuntime().exec command? -
there's issue when run android runtime.getruntime().exec
method.
i have native binary file run on android , start java method runtime.getruntime().exec
. running native binary file requires addition of environment variable. execute command:
envsetcmd = {"sh", "-c", "export ld_library_path="+excbinfilepath+":$ld_library_path"}.
it doesn't work when check environment variable command: sh
, -c
, echo $ld_library_path
.
i think reason when set environment variables start shell , when check command "echo" shell started. environment variables didn't work in shell check it.
i think there 2 ways solve issue. 1 running 2 commands in 1 shell. tried use command:
{"sh", "-c", "export ld_library_path="+excbinfilepath+":$ld_library_path", "-c", "echo $ld_library_path"}.
unfortunately illegal. other add environment variables android user startup files. tried echo $path
, , see /system/bin/
, other path loaded @ startup of android.
so think there must file ~/.bashrc
in linux set users' environment.
any 1 give me clues ways listed above? way, shouldn't root phone!
try execute whatever need execute env:
{"env", "ld_library_path="+excbinfilepath, "yourcmd"}
Comments
Post a Comment