up vote 1 down vote favorite
share [g+] share [fb]
C:\Documents and Settings\js>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.6.0_11

C:\Documents and Settings\js>cd  %JAVA_HOME%\bin

C:\Program Files\Java\jdk1.6.0_11\bin>%JAVA_HOME%\bin java
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

How to solve this white space problem?

Thanks.

link|improve this question
This windows command prompt is not DOS, you are not running this in a DOS environment. – whatsisname Sep 22 '09 at 23:18
feedback

migrated from stackoverflow.com Sep 27 '09 at 22:17

This question came from our site for professional and enthusiast programmers.

3 Answers

Use quotation marks:

cd "%JAVA_HOME%\bin"
"%JAVA_HOME%\bin\java"
link|improve this answer
feedback

If the "Java" is an application you must do this to run.

"%JAVA_HOME%\bin\"Java

or

"%JAVA_HOME%\bin\"Java.Exe
link|improve this answer
feedback

As Shog9 said, you have to quote the path:

cd "%JAVA_HOME%\bin"

link|improve this answer
Just tried with single quote, it doesn't work. Only works with double quote. – janetsmith Sep 22 '09 at 23:53
Perhaps I've only used single quotes in situations where there was no environment variable in the string. Then again, I haven't used command-prompt for some time. Sorry about that. I'll edit the answer so I don't mislead anyone else. – pavium Sep 23 '09 at 0:16
feedback

Your Answer

 
or
required, but never shown