# Can Java execute bash script by default?



## ikevin8me (Sep 7, 2017)

Can Java running on FreeBSD execute bash script by default?

I'm getting this error:

```
Caused by: java.io.IOException: Cannot run program "/exo/platform-public-distributions-develop/plf-community-tomcat-standalone/target/platform-community-5.0.x-SNAPSHOT/platform-community-5.0.x-SNAPSHOT/addon" (in directory "/exo/platform-public-distributions-develop/plf-community-tomcat-standalone"): error=2, No such file or directory
```
I've verified that the directory is correct, the file indeed does exist, and permission is indeed executable:

```
-rwxr-xr-x   1 root  wheel   3379 Sep  3 12:21 addon
```
That "addon" is a #!/bin/bash

What could be cause of this problem?

(I'm running Java 8 openjdk v131)

It is an open source program which I'm trying to build. I'd prefer not to modify the source code and built it as it is. Are there any environment settings I can change to make it work.


----------



## Jov (Sep 7, 2017)

Do you have bash installed?
try run:

```
type bash
```
to verify.

and also you should replace the shebang line with:

```
#!/usr/local/bin/bash
```


----------



## ikevin8me (Sep 7, 2017)

Yup. That resolved my problem. Thanks!


----------

