Java 打开 zip 文件或 JAR 清单时出错:C:/Program
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18660629/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error opening zip file or JAR manifest missing : C:/Program
提问by ubiquibacon
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\ubiquibacon>set
GRAILS_HOME=C:\Program Files\GGTS\grails-2.0.4
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_25
Path=C:\Program Files\Java\jdk1.7.0_25\bin;C:\Program Files\GGTS\grails-2.0.4\bin
C:\Users\ubiquibacon>grails
Error opening zip file or JAR manifest missing : C:/Program
Error occurred during initialization of VM
agent library failed to init: instrument
C:\Users\ubiquibacon>
I have two main Grails project I work with. Project "A" is in production is developed with Grails 2.0.4 using Netbeans, project "B" is still a prototype and is developed with Grails 2.2.4 using GGTS. I have a .bat
script I run to quickly change my GRAILS_HOME
and PATH
variables when switching between the two versions of Grails. This worked well until I decided to play around and open project "A" in GGTS. I also recently upgraded Java from 1.6.0_18 x86 to 1.7.0_25 x64. Now something is preventing Grails 2.0.4 from running at all as can be seen from the posted command line output. My environment variables and path are correct, I have deleted the .grails
directory, and I have restarted my computer, none of which have helped correct the problem.
我有两个主要的 Grails 项目。正在生产中的项目“A”是使用 Netbeans 使用 Grails 2.0.4 开发的,项目“B”仍然是一个原型并且是使用GGTS使用 Grails 2.2.4开发的。我有一个.bat
脚本可以在两个版本的 Grails 之间切换时快速更改我的GRAILS_HOME
和PATH
变量。这很有效,直到我决定在 GGTS 中玩转并打开项目“A”。我最近还将 Java 从 1.6.0_18 x86 升级到 1.7.0_25 x64。现在,从发布的命令行输出中可以看出,Grails 2.0.4 根本无法运行。我的环境变量和路径都是正确的,我已经删除了.grails
目录,并重新启动了我的计算机,这些都没有帮助解决问题。
The first line of the error is curious because it appears to be looking in a non-existent path C:\Program
. I wonder if the rest of the path may be getting hacked off because of a space C:\Program Files\???
but that is just a thought.
错误的第一行很奇怪,因为它似乎在不存在的路径中查找C:\Program
。我想知道路径的其余部分是否可能因为空间C:\Program Files\???
而被砍掉,但这只是一个想法。
I have already tried all the answers to thisquestion, none of which helped solve my issue.
我已经尝试了这个问题的所有答案,但没有一个有助于解决我的问题。
Any guidance would be appreciated.
任何指导将不胜感激。
Update:
更新:
A work around listed in the JIRA issue heresays to change line 60 of startGrails.bat
from this:
此处JIRA 问题中列出的解决方法说要更改第 60 行startGrails.bat
:
set AGENT_STRING=-javaagent:%GRAILS_HOME:\=/%/lib/com.springsource.springloaded/springloaded-core/jars/springloaded-core-1.0.5.jar -noverify -Dspringloaded=profile=grails
to this:
对此:
set AGENT_STRING="-javaagent:%GRAILS_HOME:\=/%/lib/com.springsource.springloaded/springloaded-core/jars/springloaded-core-1.0.5.jar" -noverify -Dspringloaded=profile=grails
After doing that I get a new error:
这样做后,我收到一个新错误:
C:\Users\westerhold>grails
Exception: java.lang.NumberFormatException thrown from the UncaughtExceptionHandler in thread "main"
C:\Users\westerhold>
采纳答案by ubiquibacon
I don't know why, but when I use the older version of Java I don't have any issue. I don't know if it is because my older version of Java was Java 6 instead of Java 7, or because my older version of Java was 32 bit instead of 64 bit, but setting my JAVA_HOME
variable to point to the older version of Java when using Grails 2.0.4 seems to be working.
我不知道为什么,但是当我使用旧版本的 Java 时,我没有任何问题。我不知道是因为我的旧版 Java 是 Java 6 而不是 Java 7,还是因为我的旧版 Java 是 32 位而不是 64 位,但是当我将JAVA_HOME
变量设置为指向旧版 Java 时使用 Grails 2.0.4 似乎有效。
回答by akirillov
Obviously the error cause is spaces in the path. Try to reinstall Grails
by the path without spaces.
显然,错误原因是路径中的空格。尝试Grails
按没有空格的路径重新安装。
回答by Anil Shrestha
While giving path in environment variable there should not be space,this is wrong C:\Programs Files\grails-2.3.4 so the solution is giving path like with no space C:\Programs\grails-2.3.4
在环境变量中给出路径时不应该有空格,这是错误的 C:\Programs Files\grails-2.3.4 所以解决方案是给出没有空格的路径 C:\Programs\grails-2.3.4
Hope it help :)
希望它有帮助:)