0

I want to run a jar file from shell script. But current operating system is Windows. So, how to configure to know JAVA_HOME in shell script. I want to know how to export JAVA_HOME from Windows in shell script. Path for JDK in Windows is C:\Program Files\Java\jdk1.6.0_32\bin\java When I run shell program I got the following error:

Files\Java\jdk1.6.0_32: command not found

3
  • SET JAVA_HOME = path_to_your_jdk Commented Jan 5, 2016 at 7:13
  • What happens when you enter "java -version" in the command line? Commented Jan 5, 2016 at 7:41
  • The error message indicates that you did not properly quote the blank in the file name. Commented Jan 5, 2016 at 8:34

2 Answers 2

1

The path to your JDK = JAVA_HOME is C:\Program Files\Java\jdk1.6.0_32 . You have to add %JAVA_HOME%\bin to PATH.

These lines could be part of your shell script:

set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_32
set PATH=%PATH%;%JAVA_HOME%\bin
Sign up to request clarification or add additional context in comments.

Comments

1

Although you can set these variables from a script, on Windows the normal way is to set them machine-wide.

Right-click on your computer icon in explorer. Select "Properties", then "Advanced System Settings", then "Environment Variables".

Add a variable with the name JAVA_HOME and the value C:\Program Files\Java\jdk1.6.0_32

Find the PATH variable and append ;%JAVA_HOME\bin (including the semicolon) to it.

More detailed instructions on setting path and environment variables on Windows are available here http://www.computerhope.com/issues/ch000549.htm

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.