Problem passing arguments with spaces in

Problem passing arguments with spaces in

Basic UserBasic User

    Dec 24, 2014#1

    I've created a custom tool to compile a java file. The command looks like this:

    "C:\Program Files (x86)\Java\jdk1.7.0_40\bin\javac.exe" -classpath "C:\Program Files (x86)\OtherFolder\MyJarFile.jar" %n%e

    But the output I get is:

    'C:\Program' is not recognized as an internal or external command,
    operable program or batch file.

    If the classpath argument is a jar file in a folder without spaces then the compilation works as expected.

    Looks to me like it doesn't like the spaces in the path to the .jar file, even thought I've enclosed them in double quotes.
    Am I doing something wrong or is this a bug?

    Grand MasterGrand Master

      Dec 24, 2014#2

      I created first the batch file C:\Program Files (x86)\Java\jdk1.7.0_40\bin\javac.bat with just the lines:

      Code: Select all

      @echo %0 %*
      @echo %0 %*>"%Temp%\UltraEditToolTest.tmp"
      Next I created a tool with the command line

      Code: Select all

      "C:\Program Files (x86)\Java\jdk1.7.0_40\bin\javac.bat" -classpath "C:\Program Files (x86)\OtherFolder\MyJarFile.jar" "%n%e"
      I let the working directory empty. If a working directory is specified, it must be without double quotes even if directory path contains one or more space characters.

      I selected just DOS program and unchecked both check boxes on tab Options of tool configuration.

      And finally I selected Output to list box, No replace and checked just Capture output on tab Output of tool configuration.

      As I executed the tool with a file opened in UltraEdit, everything worked as expected. I could see in output window the entire command line as passed to the batch file and also the temporary file was created containing the same command line. There was no error on running the tool several times.

      So I deleted the temporary file created by the batch file, unchecked Capture output, checked instead Show DOS box in tool configuration, and added to batch file @pause as third line.

      But the batch file was not called anymore. I enabled additionally Capture output and could see now the same error message as you.

      I unchecked next Capture output and Show DOS box in tool configuration for this tool and could see that the batch file is again not called as still no file %Temp%\UltraEditToolTest.tmp created.

      Conclusion: Running a tool with a space in path which requires therefore double quotes works only if Capture output is enabled and Show DOS box is not enabled.

      A possible workaround solution in case of Show DOS box is needed because of user input or capturing output is not wanted is for this example the usage of the command line

      Code: Select all

      javac.bat -classpath "C:\Program Files (x86)\OtherFolder\MyJarFile.jar" "%f"
      and using as Working directory

      Code: Select all

      C:\Program Files (x86)\Java\jdk1.7.0_40\bin
      Please report this issue with not working tool call for tools with file name and path in double quotes because of 1 or more spaces in path with capturing option not used or showing console window enabled to IDM support by email. I have reported this issue, too.
      Best regards from an UC/UE/UES for Windows user from Austria

      Basic UserBasic User

        Jan 06, 2015#3

        Thanks Mofi,

        I'll get a report off now. Looks like you have a workaround I can use too. many thanks.