JAVA_HOME fails on spaces and quotation marks with SET command

On WIndows 2008...

From a Command prompt...

I performed the following:

SET JAVA_HOME="c:\program files (x86)\Java60\jre"

Open in new window


Now I can do the following:

echo %JAVA_HOME%
"c:\program files (x86)\Java60\jre"

Open in new window



So now I try an installation procedure of Shibboleth, and later in the install, the install crashed on this line:

  set JAVACMD="%JAVA_HOME%\bin\java.exe"

Open in new window



The command prompt now breaks out of the .bat file and reports the following:

\Java60\jre"\bin\java.exe" was unexpected at this time.
  set JAVACMD=""c:\program files (x86)\Java60\jre"\bin\java.exe"

Open in new window


There are two spaces in the JAVA_HOME "Program Files (", so I have to set the JAAVA_HOME with quotation marks, as follows:

SET JAVA_HOME="c:\program files (x86)\Java60\jre"

Open in new window


... and either the spaces or the quotation marks are causing an issue

How can I fix this?

Thanks
Anthony LuciaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dpearsonCommented:
Much the simplest fix (if you can) is to reinstall Java so it has no space in the path.  Personally I always put it in:

"C:/Java/..."

If not you will keep running into these sorts of problems.

Doug
0
MazdajaiCommented:
Try the following without quotation:

SET JAVA_HOME=C:\progra~2\Java60\jre

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gheistCommented:
You dont have to set JAVA_HOME if you install official java package
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.