Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-8869

Warning when JAVA_HOME points to NTFS symlink

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.5.3
    • Fix Version/s: None
    • Component/s: Groovy Console, Groovysh
    • Labels:
      None
    • Environment:
      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Kyriacou Klitos
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: