Running a shell script from my plugin's directory


Hello there,

I want to run a shell script from my plugin's directory. 

Inside the resources directory, I've created another directory named "scripts" and have a script inside it named (let's say)

I tried to execute this script using Runtime.getRuntime().exec("sh") but it gave me an error :

Caused by: Cannot run program "sh": error=2, No such file or directory


I guess it's not able to find the shell script. Is there any way I can run the script in the plugin's directory? I don't want to ask the plugin's user to copy my script in his directory for it to work. It should work out of the box!


Any help would be really appreciated :)

Thanks in advance!



you can't run your bundled script this way, because it is not accessible via the filesystem - it's bundled within the plugin's artifact.

Even if - you'll need to provide a full path to the file, not just sh

I'd suggest you load the script's content and run it as a command


Jakub Chrzanowski

I am trying to run a CURL request. But it just doesn't seem to work using Runtime.getRuntime().exec()

I even posted a question on this forum as well as stack overflow:

So, I had to resort to write a script to make the curl request.

Also, how to provide the full path to a plugin artifact? Do we have any API to know the exact location of the plugin (and eventually it's artifact) in the user's machine?


Can I ask why you want to go with CURL instead of making a request right from the IDE?


Jakub Chrzanowski

Couldn't find a good Kotlin library for networking. Hence, thought it'd be easier to make API call via CURL. Didn't want to go all the way back to HttpUrlConnection.

I'm just starting with Plugin Development, and this would be my first plugin. Could you suggest something else?


What if the user will have no curl? Will Windows be appropriately handled?

Have you checked ktor?


Yeah. Hadn't thought about that !

Will check out ktor now. I did have a look at it earlier but was hooked on making a simpler CURL request.

Thank you so much :) Would've totally missed the windows compatibility thing.


Please sign in to leave a comment.