Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
2.5.3
-
None
-
None
-
Windows 7 Professional 64-bit (but probably applies to all versions of Windows)
Description
It is typical (especially on Linux) to have a symlink to a minor version of the JDK. On Windows, I've got jdk1.8 as a symlink to the latest bug-fix release:
C:\Program Files\Java>dir Volume in drive C is OSDisk Volume Serial Number is 3A80-142D Directory of C:\Program Files\Java 06/11/2018 09:36 <DIR> . 06/11/2018 09:36 <DIR> .. 06/11/2018 09:36 <SYMLINKD> jdk1.8 [jdk1.8.0_192] 17/10/2018 16:41 <DIR> jdk1.8.0_192
When I start groovysh.bat (or groovysh.exe) I get this startup message:
C:\Program Files\Java>groovysh warning: JAVA_HOME points to a nonexistent location Groovy Shell (2.5.3, JVM: 1.8.0_192) Type ':help' or ':h' for help.
Even worse, groovyconsole does not start at all.
On the other hand, although it fails with symlinks, it works with NTFS junctions.
Looking at the source, it appears to be a problem with the stat function, called from jst_fileExists, which is called from getJavaHomeFromEnvVar() in https://github.com/groovy/groovy-native-launcher/blob/master/source/jvmstarter.c .
There are other ways to find if a file exists on windows that don't use stat.