简体   繁体   中英

Grails 2.0.3 error starting from command line in Windows7

Hoping a kindred soul can assist with this odd windows problem

I am attempting to run a grails app on windows and am unable to get grails to start.

I have both downloaded the 2.0.3 distro from grails.org and pulled and built the source off of github.

The error I receive is as follows:

Error: Could not find or load main class 
       org.codehaus.groovy.grails.cli.support.GrailsStarter

The searching I've done to find solutions to this problem (which some people have had) have yielded no help: All I've found is suggestions that my environment variables are improperly set up. (eg here )

I felt I was quite careful in setting up my variables though. I have the following configured, all under System Variables:

JAVA_HOME C:\java\jdk7
GRAILS_HOME C:\grails\2.0.3  // also set it to C:\grails\source\grails-core when dlded from source
GROOVY_HOME C:\groovy\1.8.6
PATH %JAVA_HOME%\bin;%GRAILS_HOME%\bin;%GROOVY_HOME%\bin;$PATH

I've tried things both before and after downloading groovy and setting that environment variable, and I'm afraid I'm quite lost at this point. Groovy starts just fine, java starts just fine, but grails is unable to start.

Is anyone else in Windows having this issue with the latest grails version?

I feel like a fool for not trying this, but...

Grails is working as a command from the Windows DOS prompt (cmd). It is NOT working from the bash I've been using on windows (git bash, out of convenience and familiarity with the linux cmds).

For those of you that find yourselves in this situation, Make SURE you try this in the Windows cmd prompt as well. (Those with any insight into why this is working in the DOS prompt but not in a custom linux-like bash please weigh in, I will update this answer with any findings I come across!)

I ran into this error message in the DOS CMD shell. Turned out, I had my GRAILS_HOME set to 2.2.0 but my PATH was pointed to Grails-2.2.1\\bin. Once I fixed this mismatch, the error went away and things worked fine. Suggest using "set" in your CMD shell to see what your environment is actually set to.

I faced the same issue in the msysgit console and could solve this by setting the environment variable $GRAILS_HOME to the unix format:

export GRAILS_HOME=/c/grails/2.0.3

This fixed the above error but leads to a new one when executing "grails run-app":

$ grails run-app
Error opening zip file or JAR manifest missing : /d/Programme/grails-2.2.4/lib/org.springsource.springloaded/springloaded-core/jars/springloaded-core-1.1.3.jar
Error occurred during initialization of VM
agent library failed to init: instrument

The jar can be found under logged path, so i dont know why it doesnt work. I'm still trying to solve this error.

I hope the above solution could help anybody.

Grails 2.3.7, Win7, Java7, msysgit:

By default grails is failed to start from msysgit.

To fix copy cygpath.exe from cygwin to msysgit/bin. And modify startGrails

In the section # For Cygwin, ensure paths are in UNIX format before anything is touched

Replace

    if $cygwin ; then

with

    if [ $cygwin -o $mingw ] ; then

or just set GRAILS_HOME in grails/bin/startGrails in unix style, for example

$GRAILS_HOME=/c/program/grails-2.3.7

ps

useful link about cygpath.exe

Your set up should work as-is afaict. I would verify that my grails installation is not corrupt.

I had this problem and I realized that I had groovy 2.1.7 in the path. I removed this groovy from path and Grails worked.

As user 'sfitts' pointed out in his comments (which I cannot yet append to), the problem was addressed/fixed at http://jira.grails.org/browse/GRAILS-8271 . This fix was already incorporated in my Grails 2.3.11 installation.

However I additionally had to undefine my GRAILS_HOME environment variable in Windows for this to work (the startup script automatically detects and sets this variable).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM