I wanted to create a groovy script to run grails clean, grails compile and grails run-app, However, I noticed that I cannot run any of the grails commands. In fact then I tried to run the following script on the Groovy Console:
def envs = System.getenv().collect{"$it.key=$it.value"}
//println envs
println "java -version".execute(envs, new File("c:\\")).err.text
println "grails -version".execute(envs, new File("c:\\")).text
This itself gives me the following output:
groovy> def envs = System.getenv().collect{"$it.key=$it.value"}
groovy> //println envs
groovy> println "java -version".execute(envs, new File("c:\\")).err.text
groovy> println "grails -version".execute(envs, new File("c:\\")).text
java version "1.7.0_06"
Java(TM) SE Runtime Environment (build 1.7.0_06-b24)
Java HotSpot(TM) 64-Bit Server VM (build 23.2-b09, mixed mode)
Exception thrown
java.io.IOException: Cannot run program "grails" (in directory "c:\"): CreateProcess error=2, The system cannot find the file specified
at ConsoleScript26.run(ConsoleScript26:4)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
... 1 more
Has anyone faced this problem before?