简体   繁体   English

从Windows7中的命令行开始Grails 2.0.3错误

[英]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. 我试图在Windows上运行grails应用程序,无法启动grails。

I have both downloaded the 2.0.3 distro from grails.org and pulled and built the source off of github. 我已经从grails.org下载了2.0.3发行版并从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和设置环境变量之前和之后都尝试了一些东西,我担心此时我已经迷失了。 Groovy starts just fine, java starts just fine, but grails is unable to start. Groovy开始很好,java开始很好,但grails无法启动。

Is anyone else in Windows having this issue with the latest grails version? Windows中是否有其他人使用最新的grails版本出现此问题?

I feel like a fool for not trying this, but... 我不觉得这样做是个傻瓜,但......

Grails is working as a command from the Windows DOS prompt (cmd). Grails正在从Windows DOS提示符(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). 它不是我在Windows上使用的bash工作(git bash,出于方便和熟悉linux cmds)。

For those of you that find yourselves in this situation, Make SURE you try this in the Windows cmd prompt as well. 对于那些在这种情况下发现自己的人,请务必在Windows cmd提示符下尝试此操作。 (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!) (那些了解为什么这个在DOS提示符下工作而不是在自定义类似Linux的bash中的人请重点说明,我会用我遇到的任何调查结果来更新这个答案!)

I ran into this error message in the DOS CMD shell. 我在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. 事实证明,我将GRAILS_HOME设置为2.2.0,但我的PATH指向了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. 建议在CMD shell中使用“set”来查看实际设置的环境。

I faced the same issue in the msysgit console and could solve this by setting the environment variable $GRAILS_HOME to the unix format: 我在msysgit控制台中遇到了同样的问题,可以通过将环境变量$ GRAILS_HOME设置为unix格式来解决这个问题:

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”时导致了一个新错误:

$ 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: Grails 2.3.7,Win7,Java7,msysgit:

By default grails is failed to start from msysgit. 默认情况下,grails无法从msysgit启动。

To fix copy cygpath.exe from cygwin to msysgit/bin. cygpath.exe从cygwin复制到msysgit / bin。 And modify startGrails 并修改startGrails

In the section # For Cygwin, ensure paths are in UNIX format before anything is touched # For Cygwin, ensure paths are in UNIX format before anything is touched部分中# 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 或者只是以unix样式在grails / bin / startGrails中设置GRAILS_HOME

$GRAILS_HOME=/c/program/grails-2.3.7

ps PS

useful link about cygpath.exe 有关cygpath.exe的有用链接

Your set up should work as-is afaict. 你的设置应该按原样运作。 I would verify that my grails installation is not corrupt. 我会验证我的grails安装没有损坏。

I had this problem and I realized that I had groovy 2.1.7 in the path. 我遇到了这个问题,我意识到我在路径中有一个groovy 2.1.7。 I removed this groovy from path and Grails worked. 我从路径中删除了这个groovy并且Grails工作了。

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 . 正如用户'sfitts'在他的评论中指出的那样(我还不能补充),这个问题已在http://jira.grails.org/browse/GRAILS-8271上得到解决/修复。 This fix was already incorporated in my Grails 2.3.11 installation. 此修复程序已包含在我的Grails 2.3.11安装中。

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). 但是,我还必须在Windows中取消定义我的GRAILS_HOME环境变量才能使其工作(启动脚本会自动检测并设置此变量)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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