This is the next article from Grovvy and Grails Part 1 – Introduction that you can read it here. Now we continue to install grails in your machine. Before you continue, there are some requirements to run Grails in your machine, so please read it carefully 🙂
Requirements to install Grails:
- Java SDK 1.4 or higher and have set your JAVA_HOME variable to the SDK install location. note here, Java OpenSDK and JRE is not working with Grails.
- Apache Ant 1.6.5 or higher *
- JUnit (to run the build tests – put junit.jar in your ANT_HOMElib directory) *
- Subversion client *
Note: * , if you planning to install grails from SVN, to keep your installation uptodate
Steps to install Grails from binary release:
- Download grails binary Zip or Tar/Gz
- Extract to any location in your drive, usually in C:grails (on windows) , ~/grails (on Linux)
- Create a GRAILS_HOME environment variable that points to the path where you extracted the archive (eg C:grails on Windows or ~/grails on Unix)
- Check if JAVA_HOME already set in environment variable, if not set it now.
- Append a reference to the “bin” directory within the Grails directory to your PATH variable (eg %GRAILS_HOME%bin on Windows or $GRAILS_HOME/bin on Unix)
- Type “grails” at the command line, if a help message is displayed you are ready
- On Linux, if you get an error message, try to
grailsscript inside the
Steps to install Grails from source or subversion:
- Download Grails binary Zip or Tar/Gz or checkout from subversion with this command:
svn co http://svn.codehaus.org/grails/trunk/grails/
- Set the JAVA_HOME environment variable
- Set the GRAILS_HOME environment variable to your Grails extract or checkout folder
- Add the “%GRAILS_HOME%bin” directory to your PATH environment variable
- Add the “%GRAILS_HOME%antbin directory to your PATH environment variable.
- Run chmod +x in “%GRAILS_HOME%antbin
- Go to the %GRAILS_HOME% directory and type “ant” to build Grails
- Wait until it finish compiled, and you are ready to use Grails
Note: To update subversion folder, you can use this command: svn up , and every update you need to run recompile Grails again (refer to step 7).
Next article: Groovy and Grails Part 2 – Create a Web Application