Running Maven Command From Java Program (From Eclipse) Mac OS

2015-08-20T20:43:47

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");

Copyright License:
Author:「Rahul Juyal」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/32118603/running-maven-command-from-java-program-from-eclipse-mac-os

About “Running Maven Command From Java Program (From Eclipse) Mac OS” questions

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 ...
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 ...
Did anybody try to install Eclipse Indigo EE on Mac OS Lion? My Windows Machine died and I had to install Eclipse 3.7 on my Mac OS Lion. I updated Eclipse with Maven. And for 2 days I could not fig...
I've been trying to run eclipse from my mac os x terminal and I'm getting the error that no such eclipse command is found. I added the directory to my PATH variable and I'm able to run this just fi...
I've recently set up an OSX machine and i have trouble getting Maven to pickup JAVA_HOME when running inside Eclipse. I've done the following so far: Set JAVA_HOME in ~/.bash_profile with export
I have a Mac OS X 10.6. I would like to install the Eclipse Helios and Glassfish 2.2.1 and the Maven on to it. Everything is fine, but I have some questions: Which eclipse version should I download?
I am trying to run 'mvn install' from maven eclipse plugin as follows The build fails and throws MavenReportException: Error while creating archive: Unable to find javadoc command: The
I have often seen problems arise with encoding. Therefore I have written down this instruction set to do all the needed actions in order to make things work (with encoding). This set is related to
After my recent Mac OS upgrade to Big Sur , I'm unable to open Eclipse(it says Failed to create the java Virtual machine).Also I get " No compiler is provided in this environment. Perhaps you ...
I have downloaded a fresh copy of Eclipse IDE for Java Developers for Mac Cocoa 64-bit running on my macOS High Sierra 10.13.1 I have a maven project (not an eclipse project) which I have cloned i...

Copyright License:Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.