Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ does not recognize PATH variable

I recently tried to import an existing Gradle project, using the option "Open Project" in the startup window and the existing build.gradle file to automatically set-up the project.

Right after I did this, an error message appeared in IntelliJ, saying:

Could not fetch model of type 'BasicIdeaProject' using Gradle installation '/Users/myUser/Tools/gradle-1.3'. Build file '/Users/myUser/IdeaProjects/myProject/database/build.gradle' line: 20 A problem occurred evaluating project ':database'. A problem occurred evaluating project ':database'. 'play' command was not found in PATH. Make sure you have Play Framework 2.0 installed and in your path

As it looks like, IntelliJ complains that I did not add the play framework to my PATH variable. Although output from the shell tells sth. else:

echo $PATH; 
/usr/local/bin:/Users/myUser/Library/Ruby/Gems/1.8/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/Users/myUser/.yadr/bin:/Users/myUser/.yadr/bin/yadr:/Users/myUser/Tools/gradle/bin:/usr/local/Cellar/mongodb/2.2.2-x86_64//bin:/Users/myUser/Tools/groovy/bin:/Users/myUser/Tools/play-2.0

I also wrote a simple class to display the PATH variable used by IntelliJ:

public class Playground {

    public static void main(String[] args) {

        System.out.println( System.getenv( "PATH" ));
    }
}

When I run this class, it gives me following output:

/usr/bin:/bin:/usr/sbin:/sbin

As it looks like, IntelliJ completely ignore the PATH variable set in the shell. So I'd like to know how to manipulate/configure IntelliJ to recognise this PATH variable?

The shell I am using is zsh.

Thanks in advance

like image 617
u6f6o Avatar asked Mar 04 '13 12:03

u6f6o


People also ask

How do I use path variables in IntelliJ?

Press Ctrl+Alt+S to open the IDE settings and select Appearance & Behavior | Path Variables. , enter the name and value of the variable, and click OK to apply the changes.

How do I set classpath variables in IntelliJ?

In IntelliJ, Eclipse classpath variables are called path variables and they are accessible via this link: File > Settings > Appearance & Behaviour > Path Variables.

Do I Update PATH variable IntelliJ?

A 64-bit launcher is advisable if you're working on multiple and/or large scale projects since it allocates more RAM. Update Path Variable: Updating the PATH variable will allow you to use the command line to run projects in IntelliJ.


2 Answers

Check this post: http://emmanuelbernard.com/blog/2012/05/09/setting-global-variables-intellij/ The problem is that IDEA doesn't read your .zshrc file and doesn't know about path to play. Try to set PATH variable manually in IDEA settings.

like image 137
Mikita Belahlazau Avatar answered Sep 28 '22 04:09

Mikita Belahlazau


You can actually use "open -a [IntelliJ App]" on mac from the command line and it should pick up your path variables for your .bash_profile and/or .zshrc - better than cutting and pasting into IntelliJ IMO. Seems to be a mac only issue if I'm not mistaken.

like image 44
Tyrus Avatar answered Sep 28 '22 04:09

Tyrus