问题
I have already read some posts but I cant solve my problem yet.
I am working on a remote desktop and windows server 2008. In the shared disk E: I put some batch file. This batch files call a new batch file from server which runs java
script. And now I am taking the this message.
java.exe is not recognized as an internal or external command, operable program or batch file
.
I try to set the environment like :
First setup the JRE7 to disk E
Second create new user variable which name is JAVA_HOME
and which path is my JRE path E:\Tool\BatFiles
But I am still taking this error. Where should I do wrong ?
回答1:
Setting JAVA_HOME is a good step, and with it you should be able to run Java as follows
%JAVA_HOME%/java myProgram arg0
If you don't want to include %JAVA_HOME
in your command, you will have to include it in your PATH
. Windows checks it's PATH
for bin scripts every time a command is called. A typical Java installation does this for you.
You can edit your PATH
to include ;%JAVA_HOME%
at the end. Restart your command prompt for changes to take effect.
Edit 1
Be careful when editting your PATH however! Windows depends on it to function in many aspects. You can expect explorer
to stop working. Make sure before altering your PATH
variable, that you back it up somewhere. Just in case.
来源:https://stackoverflow.com/questions/20218354/java-exe-is-not-recognized-as-an-internal-or-external-command