问题
I don't know what I'm doing wrong...
First I've downloaded, and unzipped the folder in C:\ :


Then, set it as a user variable :

And added it to my PATH :

And even after restarting cmd, when I check grails -version
I get this :
grails is not recognized as an internal or external command, operable program or batch file.
What is wrong? Thanks for your help.
回答1:
First try this one on CMD
commandline type
echo %GRAILS_HOME%
Then type path
and see if the grails paths is something like :
C:\Windows\system32;C:\Windows;C:\grails2.1.1
ok , if in any case i sugget you replace the GRAILS_HOME
with C:\grails2.1.1
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\Wind owsPowerShell\v1.0\;%JAVA_HOME%\bin;%GRAILS_HOME%\bin;
with
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\Wind owsPowerShell\v1.0\;%JAVA_HOME%\bin;c:\grails2.1.1\bin;
Then logout or restart the PC it should work ,if not check your package of grails for a file names grails.bat something or try to run it by giving the exact path from CMD
!!
like :
cmd > c:\grails2.1.1\bin\startGrails.bat
回答2:
To troubleshoot what is the error using CD go to the location C:\Grails\bin and execute the command grails.bat, if it executes then check for path again else there is problem in grails downloaded jar.
回答3:
Make sure you do not have spaces or special characters in the following paths
e.g. JDK path it should be JAVA_HOME=C:\Java7\jdk1.7.0_40
GRAILS_HOME path (use underscores or hyphens) e.g. c:\grails_221
Check the java version by using the command - java -version, many times this is not set correctly
Finally make sure your bin directories are appended to your PATH variable
Also check - http://grails.org/installation
回答4:
The problem is the - character in folder's name.
Instead of grails-2.1.1 use grails2.1.1 and it will work perfectly.
来源:https://stackoverflow.com/questions/20045439/grails-is-not-recognized-as-an-internal-or-external-command-windows-7