Uploaded image for project: 'Grails'
  1. Grails
  2. GRAILS-7936

Grails command line not handling blanks in Windows

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-M1, 2.0.3
    • Fix Version/s: 2.1.5, 2.2.2, 2.3-M1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Windows 7 64-bit

      Description

      Not sure if duplicate since the issue has been raised multiple time during different versions...

      1. Installed JDK in D:\Program Files\java\jdk1.7.0
      2. Set JAVA_HOME and GRAILS_HOME appropriately in environment variables and path
      3. Tried running grails command in cygwin/cmd and get:

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

      Workaround: setting the java agent manually... "grails -javaagent:'d:/Program Files/java/jdk1.7.0'"

        Issue Links

          Activity

          Hide
          Alex Duan added a comment -

          Workaround only works to get into console, but unable to run-app

          Show
          Alex Duan added a comment - Workaround only works to get into console, but unable to run-app
          Hide
          Graeme Rocher added a comment -

          Burt - could you take a look on your Windows box when you have a mo?

          Show
          Graeme Rocher added a comment - Burt - could you take a look on your Windows box when you have a mo?
          Hide
          Joel Richon added a comment - - edited

          I had this problem with cygwin and found that adding
          AGENT=`cygpath --path --mixed "$AGENT"`
          at line 247 of startGrails resolved that problem, though it breaks other commands.

          Show
          Joel Richon added a comment - - edited I had this problem with cygwin and found that adding AGENT=`cygpath --path --mixed "$AGENT"` at line 247 of startGrails resolved that problem, though it breaks other commands.
          Hide
          Nicholas Vaidyanathan added a comment -

          Problem persists on Grails 2.0.0M2. Also exists on Windows XP SP3 running with java 1.6.27. Seems to be something wonky in environment, as other Windows 7 distros I've run have not had issues.

          Show
          Nicholas Vaidyanathan added a comment - Problem persists on Grails 2.0.0M2. Also exists on Windows XP SP3 running with java 1.6.27. Seems to be something wonky in environment, as other Windows 7 distros I've run have not had issues.
          Hide
          Vitaliy S added a comment -

          I have the same issue: I downloaded grails 2.0.1 into "...\Working Tools" folder.
          Created my first project successfully and than try to execute "grails -run-app" command I gained erroe "...JAR manifest missing ...\Working".
          I tried next command "grails -noreloading" and than print "run-app" and message appear "Server is running. Browse to...".

          Show
          Vitaliy S added a comment - I have the same issue: I downloaded grails 2.0.1 into "...\Working Tools" folder. Created my first project successfully and than try to execute "grails -run-app" command I gained erroe "...JAR manifest missing ...\Working". I tried next command "grails -noreloading" and than print "run-app" and message appear "Server is running. Browse to...".
          Hide
          Matthew Smith added a comment -

          Possible duplicate issues:
          http://jira.grails.org/browse/GRAILS-7836
          http://jira.grails.org/browse/GRAILS-8264

          Happens in 2.0.3, windows XP, Java 1.6_31, too.

          Show
          Matthew Smith added a comment - Possible duplicate issues: http://jira.grails.org/browse/GRAILS-7836 http://jira.grails.org/browse/GRAILS-8264 Happens in 2.0.3, windows XP, Java 1.6_31, too.
          Hide
          Peter Ledbrook added a comment -

          A quick fix that worked for me:

          1. Edit %GRAILS_HOME%\bin\startGrails.bat
          2. On line 60, add double quotes immediately before -javaagent:%GRAILS_HOME... and immediately after ...springloaded-core-1.0.5.jar

          That's it! This could in fact be the general fix. Testing of it would be appreciated.

          Show
          Peter Ledbrook added a comment - A quick fix that worked for me: Edit %GRAILS_HOME%\bin\startGrails.bat On line 60, add double quotes immediately before -javaagent:%GRAILS_HOME... and immediately after ...springloaded-core-1.0.5.jar That's it! This could in fact be the general fix. Testing of it would be appreciated.
          Hide
          Matthew Smith added a comment -

          @Peter: Yes! That worked for me! Thanks!

          Show
          Matthew Smith added a comment - @Peter: Yes! That worked for me! Thanks!
          Hide
          cdeszaq added a comment -

          Confirmed that the fix @Peter suggested fixes the problem.

          Clean install of Grails had issue in this ticket, after applying fix, everything was fine.

          Relevant environment:

          • Windows 7 x64
          • Grails 2.0.3
          • Groovy 1.8.6
          • JVM 1.6.0_21
          • GRAILS_HOME=C:\Program Files (x86)\Grails\grails-2.0.3
          • GROOVY_HOME=C:\Program Files (x86)\Groovy\Groovy-1.8.6
          • JAVA_HOME=C:\Program Files (x86)\Java\jdk1.6.0_21
          • Relevant PATH: PATH=...;%JAVA_HOME%\bin;%GROOVY_HOME%\bin;%GRAILS_HOME%\bin
          Show
          cdeszaq added a comment - Confirmed that the fix @Peter suggested fixes the problem. Clean install of Grails had issue in this ticket, after applying fix, everything was fine. Relevant environment: Windows 7 x64 Grails 2.0.3 Groovy 1.8.6 JVM 1.6.0_21 GRAILS_HOME=C:\Program Files (x86)\Grails\grails-2.0.3 GROOVY_HOME=C:\Program Files (x86)\Groovy\Groovy-1.8.6 JAVA_HOME=C:\Program Files (x86)\Java\jdk1.6.0_21 Relevant PATH: PATH=...;%JAVA_HOME%\bin;%GROOVY_HOME%\bin;%GRAILS_HOME%\bin
          Hide
          Amit Maheshwari added a comment -

          Above fix worked for me too but a windows path having spaces is common, it should be fixed. This was the hello world i was trying and took me half an hour to get it up and running.
          Relevant Environment
          Windows XP
          Grails 2.0.3
          JDK 1.7.0
          GRAILS_HOME=C:\Projects\Groovy and Grails\grails-2.0.3\grails-2.0.3
          JAVA_HOME=C:\Program Files\Java\jdk1.7.0
          Relevant PATH: PATH=...;%JAVA_HOME%\bin;%GRAILS_HOME%\bin

          Show
          Amit Maheshwari added a comment - Above fix worked for me too but a windows path having spaces is common, it should be fixed. This was the hello world i was trying and took me half an hour to get it up and running. Relevant Environment Windows XP Grails 2.0.3 JDK 1.7.0 GRAILS_HOME=C:\Projects\Groovy and Grails\grails-2.0.3\grails-2.0.3 JAVA_HOME=C:\Program Files\Java\jdk1.7.0 Relevant PATH: PATH=...;%JAVA_HOME%\bin;%GRAILS_HOME%\bin
          Hide
          Jiri Hron added a comment -

          Another workaround is to provide 8.3 file notation in path
          so instead of

          GRAILS_HOME=C:\Program Files (x86)\Grails\grails-2.0.3

          something like

          GRAILS_HOME=C:\PROGRA~2\Grails\grails-2.0.3

          hint: To get right folder name in 8.3 notation use dir /X

          Show
          Jiri Hron added a comment - Another workaround is to provide 8.3 file notation in path so instead of GRAILS_HOME=C:\Program Files (x86)\Grails\grails-2.0.3 something like GRAILS_HOME=C:\PROGRA~2\Grails\grails-2.0.3 hint: To get right folder name in 8.3 notation use dir /X
          Hide
          gonfi den tschal added a comment -

          the bug report says: "Affects Version/s: 2.0-M1, 2.0.3"
          i just downloaded and installed grails 2.1.1 and i'm affected also.

          (in the last 10 years i've been affected by space-in-program files issues so often. each time i'm reminded of the south park episode where gates had a short appearance. i believe it was a mistake to put a space in there, the german version with "programme" is better.)

          Show
          gonfi den tschal added a comment - the bug report says: "Affects Version/s: 2.0-M1, 2.0.3" i just downloaded and installed grails 2.1.1 and i'm affected also. (in the last 10 years i've been affected by space-in-program files issues so often. each time i'm reminded of the south park episode where gates had a short appearance. i believe it was a mistake to put a space in there, the german version with "programme" is better.)
          Hide
          Alexander Franz added a comment -

          Strangely, the problem does exist on a german Win7/grails 2.1.1 as well, despite the C:\Programme...

          The fix mentioned above worked there too.

          Show
          Alexander Franz added a comment - Strangely, the problem does exist on a german Win7/grails 2.1.1 as well, despite the C:\Programme... The fix mentioned above worked there too.
          Hide
          SriHarshareddyk added a comment - - edited

          Adding double quotes as mentioned fixes the problem in v2.1.1 on Windows XP box. I believe this fix should be merged with the source.

          Show
          SriHarshareddyk added a comment - - edited Adding double quotes as mentioned fixes the problem in v2.1.1 on Windows XP box. I believe this fix should be merged with the source.
          Hide
          Graeme Rocher added a comment -

          Anybody able to provide a patch?

          Show
          Graeme Rocher added a comment - Anybody able to provide a patch?
          Hide
          SriHarshareddyk added a comment -

          Patch file for the grails startup issue via windows command line.

          Show
          SriHarshareddyk added a comment - Patch file for the grails startup issue via windows command line.
          Hide
          Jeff Scott Brown added a comment -

          The patch has been applied.

          Thanks for the help!

          Show
          Jeff Scott Brown added a comment - The patch has been applied. Thanks for the help!
          Hide
          Alex Coyle added a comment -

          Hi there,

          I am still seeing this issue in the following environment:

          • Windows 7 x64
          • Grails 2.3.1
          • JVM 1.7.0_45 (x64)
          • GRAILS_HOME=C:\Program Files\grails-2.3.1
          • JAVA_HOME=C:\Program Files\Java\jdk1.7.0_45
          • Relevant PATH: PATH=...;%JAVA_HOME%\bin;%GRAILS_HOME%\bin
          Error opening zip file or JAR manifest missing : C:\Program%20Files\grails-2.3.1\lib\org.springsource.springloaded\springloaded-core\jars\springloaded-core-1.1.4.jar
          Error occurred during initialization of VM
          agent library failed to init: instrument
          

          The only workaround for me was to relocate Grails to a path without spaces...

          Could the issue be re-opened?

          Thanks

          Show
          Alex Coyle added a comment - Hi there, I am still seeing this issue in the following environment: Windows 7 x64 Grails 2.3.1 JVM 1.7.0_45 (x64) GRAILS_HOME=C:\Program Files\grails-2.3.1 JAVA_HOME=C:\Program Files\Java\jdk1.7.0_45 Relevant PATH: PATH=...;%JAVA_HOME%\bin;%GRAILS_HOME%\bin Error opening zip file or JAR manifest missing : C:\Program%20Files\grails-2.3.1\lib\org.springsource.springloaded\springloaded-core\jars\springloaded-core-1.1.4.jar Error occurred during initialization of VM agent library failed to init: instrument The only workaround for me was to relocate Grails to a path without spaces... Could the issue be re-opened? Thanks
          Hide
          SriHarshareddyk added a comment -

          I wasn't able to recreate this issue. Could you try running in debug mode and provide more information?

          Show
          SriHarshareddyk added a comment - I wasn't able to recreate this issue. Could you try running in debug mode and provide more information?
          Hide
          Patrick Jungermann added a comment -

          I also have the issue with Grails 2.3.2

          Error opening zip file or JAR manifest missing : C:\Program%20Files\grails\grails-2.3.2\lib\org.springsource.springloaded\springloaded-core\jars\springloaded-core-1.1.4.jar
          Error occurred during initialization of VM
          agent library failed to init: instrument
          Error |
          Forked Grails VM exited with error
          Disconnected from the target VM, address: '127.0.0.1:64461', transport: 'socket'
          
          Process finished with exit code 1
          

          Seems like the part Program%20Files of the path is the problem (shoudl be Program Files)

          Show
          Patrick Jungermann added a comment - I also have the issue with Grails 2.3.2 Error opening zip file or JAR manifest missing : C:\Program%20Files\grails\grails-2.3.2\lib\org.springsource.springloaded\springloaded-core\jars\springloaded-core-1.1.4.jar Error occurred during initialization of VM agent library failed to init: instrument Error | Forked Grails VM exited with error Disconnected from the target VM, address: '127.0.0.1:64461', transport: 'socket' Process finished with exit code 1 Seems like the part Program%20Files of the path is the problem (shoudl be Program Files )
          Hide
          Jonathan Nisell added a comment -

          I agree with Alex Coyle. I am using IntelliJ 13 with Grails 2.3.4 and JDK 1.0.7_51 and get the same error. I have verified both in IntelliJ's "console"-view as well as running it from the command prompt.

          SOLUTION: Another solution though is running it through Cygwin. The Cygwin bash-shell seems to be more adapted to spaces in the path rather than Windows own Commad Prompt. I would rather recommend moving Grails installation to a non-space folder, than using this.

          Cygwin:

          $ grails run-app
          |Loading Grails 2.3.4
          |Configuring classpath
          .
          |Environment set to development
          .................................
          |Packaging Grails application
          .............................
          |Running Grails application
          |Server running. Browse to http://localhost:8080/
          
          
          Show
          Jonathan Nisell added a comment - I agree with Alex Coyle . I am using IntelliJ 13 with Grails 2.3.4 and JDK 1.0.7_51 and get the same error. I have verified both in IntelliJ's "console"-view as well as running it from the command prompt. SOLUTION: Another solution though is running it through Cygwin. The Cygwin bash-shell seems to be more adapted to spaces in the path rather than Windows own Commad Prompt. I would rather recommend moving Grails installation to a non-space folder, than using this. Cygwin : $ grails run-app |Loading Grails 2.3.4 |Configuring classpath . |Environment set to development ................................. |Packaging Grails application ............................. |Running Grails application |Server running. Browse to http://localhost:8080/
          Hide
          sura watthanalamlert added a comment -

          What I did was
          1. copy the whole folder of C:\Program Files\grails-2.3.8 to a location where there is no space i.e. C:\grails-2.3.8
          2. set the value of GRAILS_HOME=C:\grails-2.3.8
          3. append ;%GRAILS_HOME%\bin to Path in My Computer>properties>Advanced Tab> Environment Variables > System variables. (wish I could attach a screen shot to it but I can't)

          Show
          sura watthanalamlert added a comment - What I did was 1. copy the whole folder of C:\Program Files\grails-2.3.8 to a location where there is no space i.e. C:\grails-2.3.8 2. set the value of GRAILS_HOME=C:\grails-2.3.8 3. append ;%GRAILS_HOME%\bin to Path in My Computer>properties>Advanced Tab> Environment Variables > System variables. (wish I could attach a screen shot to it but I can't)

            People

            • Assignee:
              Jeff Scott Brown
              Reporter:
              Alex Duan
            • Votes:
              6 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Last Reviewed:

                Development