Q:

Error executing programs/compiling inside IntelliJ, no errors in command line

I recently bought a Macbook Air and it's now running Mountain Lion, but i have some problems running the company's project, the only other person using a mac on work runs Lion on his Macbook Pro and he had no such problems. 
As the title says theres no problem compiling the project on the command line, but when i try to compile it inside IntelliJ i get this error
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (requireJS-Optimizer) on project MarfeelTouch: Command execution failed. Cannot run program "node" (in directory "/Users/pedrompg/Documents/Marfeel/MarfeelTouch"): error=2, No such file or directory -> [Help 1]

The problem also happens when i compile it from the command line and try to run the program
Caused by: java.util.concurrent.ExecutionException: java.io.IOException: Cannot run program "phantomjs" (in directory "/Users/pedrompg/Documents/Tenants/vhosts/discoverint"): error=2, No such file or directory
    at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:232) ~[na:1.6.0_35]
    at java.util.concurrent.FutureTask.get(FutureTask.java:91) ~[na:1.6.0_35]
    at com.marfeel.pressSystem.impl.SectionPressImpl.getAllItemsFromSectionFeeds(SectionPressImpl.java:137) ~[MarfeelPressSystem-1.0.jar:na]
    ... 29 common frames omitted

It seems that i can't run any command line programs from inside the project
This is how we the phantomJS call:
private Process buildProcess() throws IOException {
        Process process;
        String[] invocationCmd = getInvocationCmd();

        if (executionDirectory != null) {
            if (LOG.isDebugEnabled()) {
                LOG.info("Invoking PhantomJS with {} in {}.", Arrays.toString(invocationCmd), executionDirectory);
            }

            process = Runtime.getRuntime().exec(invocationCmd, null,
                    new File(executionDirectory));
        } else {
            if (LOG.isDebugEnabled()) {
                LOG.info("Invoking PhantomJS with {} in {}.", Arrays.toString(invocationCmd));
            }

            process = Runtime.getRuntime().exec(invocationCmd, null);
        }

        return process;
    }

the getInvocationCmd() returns the following array
[phantomjs,--load-images=no,--disk-cache=yes,--max-disk-cache-size=1048576,/Users/pedrompg/Documents/Marfeel/MarfeelHub/target/webapp/WEB-INF/classes/whiteCollar.js,marca/marca.js,http://www.marca.com/]

Don't know if i leave any relevant information
We use Maven, tomcat 7, nodeJS, phantomJS 1.5, nginx 1.2.4, java 1.6.0_35 on the project
Hope someone can help, i'm getting really worried about this, already wasted 2 days trying to solve this problem.
Thanks in advance

A:

As you are using Mac, it's most likely environment related issue. Please note that on Mac GUI applications do not inherit Terminal environment variables, therefore if you have adjusted PATH variable and command works from the Terminal, it will not work when you try to run from other applications.
See the related questions about this Mac feature. Pay attention to the second link, Mountain Lion has different behavior for environment variables.
The easiest way to verify that it's the case and workaround the problem is to run IntelliJ IDEA from Terminal:
open -a /Applications/IntelliJ\ IDEA\ 11.app/

This way Terminal environment will be passed to IDEA and commands you can run from Terminal will also run from IntelliJ IDEA.

