简体   繁体   中英

Execute an external program from an android app

I need to execute 'nmap' binary for my app. I use the wrapper nmap4j, in which i write the path on the device "sdcard/Nmap/bin/nmap".

try {
    nmap4j.execute();
} catch(Exception e) {
    System.out.println("error execute " + e);
}

The following error : error execute org.nmap4j.core.nmap.NMapExecutionException: Cannot run program "sdcard/Nmap/bin/nmap": error=13, Permission denied

showed up, and the app crashes because of a null pointer exception later

So, I found the solution to THIS problem.

I used the Android Studio "Device File Explorer", and I uploaded my binay executable in the application data folder:

root/data/data/com.example.appname/

Hope it can help

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM