I'm trying to run a .jar file by right-clicking on a folder and selecting an item in the context menu. It works when the (Default)
value in HKEY_CLASSES_ROOT\Directory\shell\MyJar\command
is:
"C:\Program Files (x86)\Java\jdk1.8.0_40\bin\java.exe" -jar "D:\path\to\MyJar.jar"
But with the following value, I get a popup saying "Application not found":
java -jar "D:\path\to\MyJar.jar"
Either of those lines works just fine if I enter it into the command prompt, so I'm thinking the problem has to do with the registry somehow not "seeing" the classpath path.
Below are my system variable JAVA_HOME
and the beginning of my system variable Path
, respectively:
C:\Program Files (x86)\Java\jdk1.8.0_40
%JAVA_HOME%\bin;C:\ProgramData\Oracle\Java\javapath;
I'm on windows 8.1, and java version 1.8.0_40.
EDIT: clarified wording. Answer to Guoliang Liu:
1. Yes.
2.
java -version
yields:
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b26)
Java HotSpot(TM) Client VM (build 25.40-b25, mixed mode, sharing)
3.
echo %PATH%
begins with
C:\Program Files (x86)\Java\jdk1.8.0_40\bin;C:\ProgramData\Oracle\Java\javapath;
echo %JAVA_HOME%
yields:
C:\Program Files (x86)\Java\jdk1.8.0_40