Windows JAVA HOME 问题
我正在尝试在 Windows Vista 服务器上试验 OracleHelp for Java。 我下载了 Oracle 帮助,并按照其安装说明进行操作,其中指出:
- 将 OHJ 安装 .zip 文件解压缩到您选择的目录中
- 确保将 JAVA_HOME 环境变量设置为兼容 Java SE 安装的位置
在 OHJ 安装目录中,有一个 bin 子目录,其中包含 Windows .cmd 文件和 Unix/Linux shell 脚本。 在 Windows 平台上,双击 .cmd 文件以启动它们(或在命令行中键入 .cmd 文件名)。 在 Unix 平台上,输入“sh scriptName.sh”来执行 shell 脚本。
- ohguide.cmd (ohguide.sh) - 启动 Oracle 帮助指南文档
- choiceDemo.cmd (choiceDemo.sh) - 启动 Oracle 帮助功能演示
- cshDemo.cmd (cshDemo.sh) - 启动上下文相关帮助的演示
- helpsetDemo.cmd (helpsetDemo.sh) - 启动帮助集预览器来测试您的帮助集
- authoringWizard.cmd (authoringWizard.bat) - 启动帮助集创作向导
当我在 Windows 上设置 JAVA_HOME 时,我可以使用或不使用引号来设置它。 无论哪种方式都会失败:
带引号:
C:\Users\Amir\Desktop\ohj-5_0_0_433\ohj-5_0_0_433\bin>set JAVA_HOME="C:\Program
Files (x86)\Java\jdk1.6.0_14"
C:\Users\Amir\Desktop\ohj-5_0_0_433\ohj-5_0_0_433\bin>ohguide.cmd
C:\Users\Amir\Desktop\ohj-5_0_0_433\ohj-5_0_0_433>""C:\Program Files (x86)\Java\
jdk1.6.0_14"\bin\java.exe" -classpath "ohj.jar;help-share.jar;oracle_ice.jar;jew
t.jar;share.jar;help-demo.jar" oracle.help.demo.ChoiceDemo "demodoc\ohguide\ohgu
ide.hs"
'""C:\Program' is not recognized as an internal or external command,
operable program or batch file.
不带引号:
C:\Users\Amir\Desktop\ohj-5_0_0_433\ohj-5_0_0_433\bin>set JAVA_HOME=C:\Prog 文件 (x86)\Java\jdk1.6.0_14
C:\Users\Amir\Desktop\ohj-5_0_0_433\ohj-5_0_0_433\bin>ohguide.cmd “文件”不被识别为内部或外部命令, 可运行的程序或批处理文件。 未找到 Java 虚拟机; 请设置JAVA_HOME环境变量。
I'm trying to experiment with OracleHelp for Java on my Windows Vista server. I downloaded Oracle help, and I'm following their installation instructions which states:
- Unzip the OHJ installation .zip file into a directory of your choice
- Ensure that you have the JAVA_HOME environment variable set to the location of your compatible Java SE installation
In the OHJ installation directory, there is a bin subdirectory containing Windows .cmd files and Unix/Linux shell scripts. On Windows platforms, double click on the .cmd files to launch them (or type the .cmd file name on the command line). On Unix platforms, type "sh scriptName.sh" to execute the shell scripts.
- ohguide.cmd (ohguide.sh) - launches the Oracle Help Guide documentation
- choiceDemo.cmd (choiceDemo.sh) - launches a demo of Oracle Help features
- cshDemo.cmd (cshDemo.sh) - launches a demo of context sensitive help
- helpsetDemo.cmd (helpsetDemo.sh) - launches the Helpset Previewer for testing your helpsets
- authoringWizard.cmd (authoringWizard.bat) - launches the Helpset Authoring Wizard
When I set JAVA_HOME on windows I can set it with or without quotes. Either way fails :
with quotes:
C:\Users\Amir\Desktop\ohj-5_0_0_433\ohj-5_0_0_433\bin>set JAVA_HOME="C:\Program
Files (x86)\Java\jdk1.6.0_14"
C:\Users\Amir\Desktop\ohj-5_0_0_433\ohj-5_0_0_433\bin>ohguide.cmd
C:\Users\Amir\Desktop\ohj-5_0_0_433\ohj-5_0_0_433>""C:\Program Files (x86)\Java\
jdk1.6.0_14"\bin\java.exe" -classpath "ohj.jar;help-share.jar;oracle_ice.jar;jew
t.jar;share.jar;help-demo.jar" oracle.help.demo.ChoiceDemo "demodoc\ohguide\ohgu
ide.hs"
'""C:\Program' is not recognized as an internal or external command,
operable program or batch file.
without quotes:
C:\Users\Amir\Desktop\ohj-5_0_0_433\ohj-5_0_0_433\bin>set JAVA_HOME=C:\Prog
iles (x86)\Java\jdk1.6.0_14
C:\Users\Amir\Desktop\ohj-5_0_0_433\ohj-5_0_0_433\bin>ohguide.cmd
'Files' is not recognized as an internal or external command,
operable program or batch file.
No Java Virtual Machine found; please set JAVA_HOME environment variable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
该问题是由 JAVA_HOME 中嵌入的空白引起的。 当我在 Windows 上安装 JDK 时,我使用不包含任何空格的目录路径覆盖安装位置。 仍然有数量惊人的工具无法处理空格。
在您的特定情况下,问题是由 _init.cmd 和 ohguide.cmd 之间不一致引起的。 在一个地方,它们在 OHJ_JAVA_HOME 的使用周围有双引号,而在另一种情况下,它们没有双引号。
但有一个解决方案 - 使用目录的缩写名称。 您可以在 DOS 窗口中使用 DIR /X 命令查找该名称。 例如,在我的系统上,“C:\Program Files”的简称为“C:\Proga~1”。 您可以在设置 JAVA_HOME 时使用此值,不带任何引号。 例如
The problem is caused by the blanks embedded in your JAVA_HOME. When I install the JDK on Windows, I override the installation location with a directory path that does not contain any blanks. There are still a surprising number of tools that cannot deal with blank spaces.
In your particular case, the problem caused by an inconsistency between _init.cmd and ohguide.cmd. In one place, they have double quotes around a use of OHJ_JAVA_HOME and in the other case, they do not have double quotes.
But there is a solution - use the shortened name for the directory. You can find the name using the DIR /X command in a DOS window. For example, on my system "C:\Program Files" has the short name "C:\Proga~1". You can use this value when setting JAVA_HOME, without any quotes. e.g.
我在 Windows 系统属性中设置它,效果很好。
在 Vista 上:
I set it in Windows System Properties and that works fine.
On Vista:
在这两种情况下,当您尝试调用 java 可执行文件时,您都使用了太多引号。
在您的代码中:
应该是:
In both scenarios you are using one too many quotes when you try to call the java exectuable.
In your code this:
should be: