JAVA_HOME Mandatory for Groovy and Grails PPA
Many people have reported problems using the Groovy, Grails and Griffon PPA packages when installing their own JDK manually. Up to this point, the PPA packages have relied heavily on the update-alternatives
command for configuring what JDK to use. This has been the cause of much confusion.
Since most Groovy developers are comfortable with setting up their own development environment, I have decided to remove this dependecy on the update-alternatives
command. It is now mandatory for the user to set their own JAVA_HOME
environment variable where necessary. It would seem that the Groovy startGroovy
script is very efficient at working out the JAVA_HOME
variable for itself on Ubuntu. The Grails equivalent startGrails
not so.
When invoking grails
from the command line with no JAVA_HOME
set, the following message will be displayed on the command line:
grails: JAVA_HOME environment variable is not set
To remedy this, please add the following line to your ~/.bash_profile
or ~/.profile
file. If you require all users of your machine to use the grails
command, you can configure it globally by adding the snippet to the /etc/profile
file.
export JAVA_HOME="/path/to/my/jdk"
It is also worth noting that the PPA packages will pull in the OpenJdk 6.0 packages by default. If you are happy to use this then express your snippet as follows for a 64-bit architecture:
export JAVA_HOME="/usr/lib/jvm/java-6-openjdk-amd64"
or as follows for 32-bit:
export JAVA_HOME="/usr/lib/jvm/java-6-openjdk-i386"
Only the latest builds have been updated to this behaviour. At time of writing the affected packages are:
- Groovy 2.0.5
- Grails 2.1.1
All packages going forward will also express this behaviour. Anyone requiring this to be implemented in historic packages can request it here.