I was using the following code without any problem for my app.
我使用了下面的代码,我的应用程序没有任何问题。
inputstream = Runtime.getRuntime().exec("/system/bootmenu/recovery/sbin/tune2fs -l /data.img").getInputStream();
However recently the tune2fs executable was replaced by tune2fs library. I cant no longer get this code to work.
然而最近tune2fs可执行文件被tune2fs库所取代。我不能再让这些代码工作了。
I tried :
我试着:
inputstream = Runtime.getRuntime().exec("/system/bootmenu/recovery/sbin/tune2fs -l data.img",new String[]{"LD_LIBRARY_PATH=/system/bootmenu/recovery/sbin:$LD_LIBRARY_PATH"}).getInputStream();
But without sucess, how do I solve this problem?
但是没有成功,我怎么解决这个问题呢?
1 个解决方案
#1
2
I suggest using ProcessBuilder
instead of Runtime
:
我建议使用ProcessBuilder而不是运行时:
ProcessBuilder pb = new ProcessBuilder("/system/bootmenu/recovery/sbin/tune2fs", "-l", "data.img");
Map<String, String> env = pb.environment();
env.put("LD_LIBRARY_PATH", "/system/bootmenu/recovery/sbin:" + env.get("LD_LIBRARY_PATH"));
pb.directory(new File("/mnt/sdcard/multiboot/MIUI/"));
Process p = pb.start();
#1
2
I suggest using ProcessBuilder
instead of Runtime
:
我建议使用ProcessBuilder而不是运行时:
ProcessBuilder pb = new ProcessBuilder("/system/bootmenu/recovery/sbin/tune2fs", "-l", "data.img");
Map<String, String> env = pb.environment();
env.put("LD_LIBRARY_PATH", "/system/bootmenu/recovery/sbin:" + env.get("LD_LIBRARY_PATH"));
pb.directory(new File("/mnt/sdcard/multiboot/MIUI/"));
Process p = pb.start();