Error opening zip file or JAR manifest missing : C:\Program
Asked Answered
A

6

27

I'm on step "Running project on the Server" from https://developers.google.com/appengine/docs/java/webtoolsplatform#dynamic_web_project and I ran into a problem:

Error occurred during initialization of VM agent library failed to init: instrument Error opening zip file or JAR manifest missing : C:\Program

Another person reported a similar problem here: Error opening zip file or JAR manifest missing : C:/Program. But the solution was for a different set of technologies. I'm using Eclipse, Web Tools Platform, and Google-App-Engine.

Most likely it's because my Java is installed in C:\Program Files, a directory which contains a space. But I'm not sure how to fix this. I’m not sure how to safely move the Java\jre7 directory to a directory without a space in it.

Ameba answered 7/5, 2014 at 23:25 Comment(0)
A
39

Jordan Fish from Google Cloud Platform Support helped me solve this problem. He said:

As far as the error message when you try to start the dev_appserver, I believe this is probably due to a vm argument in the run configuration for your project. Can you please go to the run configuration (with the project selected, go to the Run menu and select Run Configurations), click on the Arguments tab, and see what is listed in the VM arguments text box?

Here was my original VM arguments:

-javaagent:C:\Program Files\eclipse\plugins\com.google.appengine.eclipse.sdkbundle_1.9.4\appengine-java-sdk-1.9.4\lib\agent\appengine-agent.jar -Xmx512m -Dappengine.fullscan.seconds=5 -Ddatastore.default_high_rep_job_policy_unapplied_job_pct=50

Here is what I changed it to (added double quotes around the directory that's passed as the -javaagent: param):

-javaagent:"C:\Program Files\eclipse\plugins\com.google.appengine.eclipse.sdkbundle_1.9.4\appengine-java-sdk-1.9.4\lib\agent\appengine-agent.jar" -Xmx512m -Dappengine.fullscan.seconds=5 -Ddatastore.default_high_rep_job_policy_unapplied_job_pct=50

This fixed my problem, I was able to complete step "Running project on the Server" from https://developers.google.com/appengine/docs/java/webtoolsplatform#dynamic_web_project

Ameba answered 7/5, 2014 at 23:25 Comment(2)
In Intellij -javaagent:"/Users/razvan/Downloads/dcevm8u232b09/Contents/Home/jre/lib/ext/hotswap-agent.jar"Findlay
the full path saved me, thank youImplement
D
12

You just have to add "" to your jar file behind -javaagent:

Deicer answered 2/7, 2017 at 9:13 Comment(1)
@Crytis: Not able to understand this. Could you please give an explicit example?Fino
T
1

If you use IntelliJ the solution appears to be slightly different. You need to edit the Run Configuration the same way that the Eclipse users do, but add the "VM Options" using this format instead:

-javaagent:[/absolute/path/DMEnhancerJava-1.0.jar][classes=META-INF/]

Note the formatting with the brackets after the colon with no spaces for each parameter. If you miss that you'll get a runtime error message about JavaAgent expecting that input format.

Also, remember that if you use a build tool like Maven or Gradle and add this to your JAVA_ARGS variable (via something like MAVEN_OPTS) you'll need to wrap the whole thing in double quotes.

The second parameter appears to be necessary to tell DMEnhancer what to instrument (mine was relative to the top level of my classpath; because my compiled POJOs were in the META-INF directory).

Lastly, you may notice that you sometimes get an error talking about a class being implemented in two places in the classpath internal to the VM:

Class JavaLaunchHelper is implemented in both <Two full classspaths shown here> One of the two will be used. Which one is undefined.

This seems to happen because of a bug in the JVM and is fixed (on MacOS X) in 1.8u152 (at the time of writing, this is considered an Early Access Release available here). See this other answer for more information on this JVM bug.

Tragus answered 17/4, 2017 at 16:4 Comment(1)
in case of Intellij idea I just had to put my jar into /opt/intellij/bin directory,no need for full path or double quotes or classes meta-inf. but thanks for this elaboration anyway, it helps to understand how it works on low-level.Cannabis
K
1

Rebuild your project or try mvn clean install

Kra answered 6/9, 2022 at 10:4 Comment(0)
S
0

Run your cmd as an Admin. When you try to startup your server and you are not starting it up as an admin you get this error.

Sap answered 5/10, 2016 at 20:43 Comment(0)
M
-1

Export jar with manifest file in eclipse as follows:

enter image description here OR

Merge manifest file with created jar. CMD: jar ufm /Users/inzamam/Desktop/inzaa.jar META-INF/MANIFEST.MF

Mensurable answered 27/6, 2019 at 6:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.