Using junctions in command lines gives odd results when running Java

P

ptoye

The OS is Windows 7, but this is probably independent of the version.


I have set up a junction in a personal folder to point to the folder with the Java executable, and have added the junction name to my PATH variable. However, when I try to run Java using the junction name I get an error message (I think from the Java executable, which seems to be missing a registry entry), while using the target folder name works fine. I find this puzzling as I'd have expected the same result as they're pointing to the same place. Has anyone got any suggestions as to what's happening and how to cure it please?


A sample console session follows:



D:\Peter\PC>jredir\java -version
Error: opening registry key 'Software\JavaSoft\JRE'
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.

D:\Peter\PC>"C:\Program Files\Java\jdk-12.0.1\bin"\java -version
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
java version "12.0.1" 2019-04-16
Java(TM) SE Runtime Environment (build 12.0.1+12)
Java HotSpot(TM) 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)

D:\Peter\PC>dir jred*
Volume in drive D is DATA
Volume Serial Number is CE44-C814

Directory of D:\Peter\PC

27/09/2019 15:11 <JUNCTION> JREDir [C:\Program Files\Java\jdk-12.0.1\bin]
0 File(s) 0 bytes
1 Dir(s) 478,793,269,248 bytes free

D:\Peter\PC>

Continue reading...
 
Back
Top Bottom