简体   繁体   中英

Cannot run program “adb” from IntelliJ plugin

My problem is that I want to run shell command from Java code (my IntelliJ plugin):

Runtime.getRuntime().exec("adb devices")

But then I receive IOException:

Cannot run program "adb": error=2, No such file or directory.

What is odd is that when I run it on debug mode it works, it's broken only when I deploy my plugin to real IntelliJ. The command also works from any terminal. The only thing which works now it typing the command with full path:

/Users/adamstyrc/utils/adb

But it's not a solution. How to fix it ? My guess would be to manually load bash PATH variable add adb exec file to project but it's not elegant solution. Thanks in advance!

You need to be sure that the correct path settings are passed to IntelliJ.

If you for example modified the path settings, or if you ran intellij from a different terminal or user, then they might not be correct.

To be sure, close down IntelliJ, start a new terminal - then verify the path settings - and start IntelliJ manually from that terminal.

如果运行的是64位计算机,请尝试使用以下命令安装32位库

      apt-get install ia32-libs

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