Hi i installed grails at
c:/grails
directory on my windows 7
after that i created GRAILS_HOME environment variable as mentioned on grails website
but now when i run this command
grails integrate-with --intellij
on command prompt it throws an error :
grails is not recognized as an internal or external command
any thoughts what i am doing wrong here
I have faced the same problem and did as follows to get rid off.
Although you have already mentioned that, you set Environment variables. I am assuring again:
In environment variables dialogue: (user variables section)
1. Set GRAILS_HOME to your extracted grails version as GRAILS_HOME=D:\GrailsEnvironment\grails-2.1.1
2. Set JAVA_HOME to your installed jdk version as JAVA_HOME=C:\Program Files\Java\jdk1.7.0_04
In environment variables dialogue: (System variables section)
1. Edit path and add D:\GrailsEnvironment\grails-2.1.1\bin
2. Edit path and add C:\Program Files\Java\jdk1.7.0_04\bin
If needed reboot your pc again. and in command prompt run 'grails -version' and 'java -version' command to check whether grails and java were perfectly installed.
If error shows then may be your grails package is corrupted, Extract your grails package newly in the specified path again. run the command to check. if necessary reboot and run command.
Thanks
Related
How to create Grails project through windows command prompt?
In Grails Documents it says to use Posh-GVM.But i want to know how to use Posh_GVM.
Make sure the JDK is properly installed and JAVA_HOME environment variable is defined. To make sure your JDK is installed, you can open a command prompt and enter
java -version
Make sure appropriate Grails files as downloaded and GRAILS_HOME environment variable is defined. To make sure Grails is installed, you can open a command prompt and enter
grails -version
Once you have successfully installed JDK and Grails, go to the folder where you want to create your Grails app and type
grails
create-app com.example.yourappname
I have consider that you have set JAVA_HOME && GRAILS HOME
Then check for JAVA_HOME && GRAILS_HOME
Type this into your command prompt :
JAVA -version
then check for
GRAILS_HOME
If both are shown their version else you reset your ENVIRONMENT variable again.
If you want create grails app through command prompt :
Go to cmd prompt :
create directory using following command:
mkdir grails_app
Then go to grails_app directory following command:
cd grails_app
Then,
Type following command to create the grails application in using command prompt:
grails create-app helloworld
Here,
helloworld - Name of grails application
For more details you can use following document :
http://docs.grails.org/2.4.4/guide/gettingStarted.html#creatingAnApplication
Hope this will help you create grails app through command prompt
i am new to liferay and is managed to start the liferay sever by setting the environment variable, but when i create a liferay plugin project it doesnt work and shows
ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\JDK1.7.0_79;
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
whereas the server is running correctly due to correct path of java_home
please help
In Windows, processes cache the environment variables. So if you have changed the environment variables when eclipse was open, new environment variables won't be reflected in eclipse. To solve that problem You can close eclipse and open it from a new instance of windows explorer. If this doesn't solve the problem, open it from the command line with a -clean parameter.
D:\eclipse>eclipse.exe -clean
I want to name my WAR files automatically depending on appName, appVersion and the short name of Environment.current. I have the following option setup in BuildConfig.groovy:
String currentEnvShortName = Environment.envNameMappings.find{it.value == Environment.current.name}.key
def f = new File("grails-app/conf/config.properties")
f.text = ""
f << "Current Env: ${currentEnvShortName}"
grails.project.war.file = "target/war/${appName}-${appVersion.toString().replaceAll(/\./,' ').split().join("-")}${currentEnvShortName}.war"
I write the environment to a file so that I don't have to wait for the war command to execute. EDIT: USING GGTS COMMAND LINE. First, I thought everything works as expected. My usual deployment process is as follows:
run grails clean
run war command for the desired environment
deploy WAR on application server
After clean, however, and possibly also after other grails commands, the value of Environment.current changes in a way I do not understand. It is always dev the first time I run the war command. After this first time, the environment name is retrieved correctly again. So what I do as a workaround is:
run grails clean
run war command for the desired environment, but break right after starting it
run war command for the desired environment
deploy WAR on application server
Am I doing anything wrong or is this a bug?
Environment to reproduce:
GGTS 3.6.4 RELEASE
Grails 2.4.2
Groovy 2.3.10
JDK 1.6.0_07
EDIT: I could not reproduce using Grails from regular command line. This behaviour only occurs with Groovy Grails Tool Suite's built in command line. The Environment seems to be switching randomly.
EDIT 2: OS: Windows 7
Well, I tried your scenario multiple times but couldn't able to reproduce that. But, if it is not working for your for some reason, you can use the another approach as follows:
Modify your code in your BuildConfig.groovy like:
// Define a custom mapping so that you can easily extend for custom environments (which will not be possible via "Environment.current.envNameMappings"
Map envNameMappings = [test: "test", development: "dev", production: "prod"]
// Read the currrent environment from System property
String currentEnv = System.getProperty("grails.env")
println currentEnv
// And this is the short name of environment you want
println envNameMappings[currentEnv]
The issue only occurs with the built in command line of Groovy Grails Tool Suite on Windows. If the war command is executed from Windows CMD, then the environment is used correctly.
However, when executing from Windows CMD, encoding breaks for me. I have addressed this specific issue in another question.
What am I doing wrong here? I'm moving to Grails 2.4.0 (Windows 7 enterprise) and am having troubles with my environment variables set up correctly. Here's my stuff....
GRAILS_HOME C:\grails\grails-2.4.0
JAVA_HOME C:\Program Files\Java\jdk1.7.0_51
yet when I run-app from a cmd prompt I get this:
C:>echo %GRAILS_HOME% C:\grails\grails-2.3.7
and also...here is entire PATH variable
%GRAILS_HOME%\bin;%JAVA_HOME%\bin;C:\oracle\product\11.2.0\client_32\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%systemroot%\System32\WindowsPowerShell\v1.0\;C:\Program Files\SlikSvn\bin;C:\Program Files (x86)\ActivIdentity\ActivClient\;C:\Program Files\ActivIdentity\ActivClient\
Given the above... when I do a run-app I get the following. What could be wrong and does it relate to my env variables?
C:\Users>grails run-app Picked up JAVA_TOOL_OPTIONS: -Djava.vendor="Sun Microsystems Inc." Error opening zip file or JAR manifest missing : C:/grails/grails-2.3.7/lib/org. springframework/springloaded/jars/springloaded-1.2.0.RELEASE.jar Error occurred during initialization of VM agent library failed to init: instrument
C:\Users>
sometimes you need to restart your command line session to resolve/reflect the changes you mande to GRAILS_HOME.
I am trying to install grails in my windows 7, I have installed JDK 1.7.0 and downloaded grails from its site and extracted in path "C:\grails", i have jdk in "C:\Program Files\Java\jdk1.7.0". I have set environment variable JAVA_HOME = "C:\Program Files\Java\jdk1.7.0\bin" and GRAILS_HOME = "C:\grails" and added "%GRAILS_HOME%\bin" and JAVA_HOME to path from advanced settings. But when i try to run "grails -v" or "grails help" i get the error "The system cannot find the path specified.". I even changed my directory to "C:\grails" and ran "grails -v" but it is still giving me the same error.
I dont know what is wrong with it, please help me installing this thing.
Thanks
JAVA_HOME = "C:\Program Files\Java\jdk1.7.0\bin" mustn't include 'bin'
You'll want to verify that Java is working correctly first by entering "java -version" at the command line.
When you say you extracted the zip into "C:\grails" does that directory now just have a single sub directory (i.e. "grails-2.5.0" or whatever version you downloaded), or does it contain a bunch of sub directories (bin, conf, dist, doc. etc)?
If the answer is the former, your GRAILS_HOME should point to "C:\grails\grails-2.5.0" instead of just C:\grails\