在Cygwin中导出带有空格的JAVA_HOME [英] export JAVA_HOME with spaces in Cygwin

查看:184
本文介绍了在Cygwin中导出带有空格的JAVA_HOME的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用此命令在Cygwin中设置我的JAVA_HOME:

I'm trying to set my JAVA_HOME in Cygwin with this command:

export JAVA_HOME="/cygdrive/c/Program Files/Java/jdk1.7.0_10"

但是当我做 cd $ JAVA_HOME ,我会得到这个错误:

But when I do cd $JAVA_HOME, I'd get this error:

$ cd $JAVA_HOME
-bash: cd: /cygdrive/c/Program: No such file or directory

转义空格(即 \ ),但没有工作。

I tried quoting, and escaping the space (ie., \), but none worked. Any idea what else would?

感谢,

推荐答案

p>我也面临这个问题,我看到很多帖子,但没有什么真正工作。有一个小技巧,我做了,事情开始工作。

I faced this problem too and I saw many posts but nothing really worked. There is a small trick that I did and things started working.

我的JAVA_HOME设置为C:/ Program Files / Java / jdk1.7.0_23。
问题是与Program Files目录,我得到相同的错误。

My JAVA_HOME was set to C:/Program Files/Java/jdk1.7.0_23. The problem was with Program Files directory and I was getting the same error.

在Windows中,为每个目录创建一个简短的名称,没有空格。
您可以通过在命令提示符下运行dir / X命令来查看它。
程序文件的短名称是PROGRA〜1。

In Windows there is a short name created for every directory with a space which is without a space. You can see it by running dir /X command on the command prompt. The Short name for Program Files was PROGRA~1.

在Windows env变量中通过我的电脑我将JAVA_HOME更改为C:/ PROGR〜1 / Java / jdk1.7.0_23和hadoop-env.sh中我将JAVA_HOME更改为/cygdrv/c/PROGRA~1/Java/jdk1.7.0_23。

In the Windows env variable through My Computer I changed the JAVA_HOME to C:/PROGR~1/Java/jdk1.7.0_23 and in hadoop-env.sh I changed JAVA_HOME to /cygdrv/c/PROGRA~1/Java/jdk1.7.0_23.

罚款。

这篇关于在Cygwin中导出带有空格的JAVA_HOME的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆