Problems with Windows JAVA HOME

I am trying to experiment with OracleHelp for Java on my Windows Vista server. I downloaded Oracle help and I follow their installation instructions that say:

  • Unzip the .jip file of the OHJ installation into the directory of your choice.
  • Make sure the JAVA_HOME environment variable is set to the location of your compatible Java SE installation.
  • The OHJ installation directory contains a bin subdirectory containing Windows.cmd files and Unix / Linux shell scripts. On Windows platforms, double-click the .cmd files to run them (or enter the name of the .cmd file at the command prompt). On Unix platforms, enter "sh scriptName.sh" to execute shell scripts.

    • ohguide.cmd (ohguide.sh) - Launches Oracle Reference Manual documentation
    • choiceDemo.cmd (choiceDemo.sh) - launches a demonstration of Oracle help functions
    • cshDemo.cmd (cshDemo.sh) - starts a demonstration of context-sensitive help.
    • helpsetDemo.cmd (helpsetDemo.sh) - launches a Helpset preview to test your helpers.
    • authoringWizard.cmd (authoringWizard.bat) - launches the Helpset creation wizard

When I install JAVA_HOME on windows, I can install it with or without quotation marks. Anyway:

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" are not recognized as internal or external command, operating program or batch file. Java virtual machine not found; specify the JAVA_HOME environment variable.

+4
source share
3 answers

I installed it in Windows System Properties and it works great.

In Vista:

  • Click the "Start" button (Windows logo, bottom left corner).
  • Right-handed computer
  • Select Properties
  • Select Advanced system settings (options on the left)
  • Select environment variables (button)
  • Add (or change) JAVA_HOME system variable
  • Enter your JAVA_HOME without quotes
  • Add a System Variable to the PATH to include the path to your JDK (so you don't have to worry about how to quote it.
  • You can also extend the CLASSPATH system variable to include those that you specify on the command line (optional).
+3
source

The problem is caused by spaces embedded in your JAVA_HOME. When I install the JDK on Windows, I redefine the installation location from a directory path that does not contain spaces. There are still an amazing amount of tools that cannot handle spaces.

In your particular case, the problem is related to inconsistency between _init.cmd and ohguide.cmd. In one place, they have double quotes around using OHJ_JAVA_HOME, and in the other case, they do not have double quotes.

But there is a solution - use the short name for the directory. You can find this name using the DIR / X command in the 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 quotes. eg.

 set JAVA_HOME=c:\progra~1\java\jdk1.6.0_14 
+9
source

In both scenarios, you use too many quotes when trying to call java exectuable.

In your code, this is:

 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" 

it should be:

 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" 
+1
source

All Articles