I want to run Maven command from Java in Mac but I am getting the following error:
Exception in thread "main" java.io.IOException: Cannot run program "mvn": error=2, No such file or directory
My code looks like this:
p = Runtime.getRuntime().exec("mvn -version");
If I run the following command, it works fine. The only issue is related to Maven:
p = Runtime.getRuntime().exec("ls -ltr");
Does mvn -version works within the terminal window in eclipse? i had an issue running mvn command on eclipse terminal while it was working in OS terminal. I found these steps that fixed my issue:
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.