[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


JAVA_HOME fails on spaces and quotation marks with SET command

Posted on 2014-08-21
Medium Priority
Last Modified: 2014-08-22
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?

Question by:Anthony Lucia
LVL 28

Expert Comment

ID: 40277687
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:


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

LVL 21

Accepted Solution

Mazdajai earned 2000 total points
ID: 40277799
Try the following without quotation:

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

Open in new window

LVL 62

Expert Comment

ID: 40278402
You dont have to set JAVA_HOME if you install official java package

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Server 2003 introduced persistent Volume Shadow Copies and made 2003 a must-do upgrade.  Since then, it's been a must-implement feature for all servers doing any kind of file sharing.
In this modest contribution, I want to share with the IT community (especially system administrators, IT Support Engineers and IT Help Desks) about Windows crashes/hangs and how to deal with these particular problems.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month18 days, 16 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question