[CMake] FindJAVA does not get version on Fedora 16

Allen D Byrne byrn at hdfgroup.org
Tue Jun 12 10:25:33 EDT 2012


The regex check for version of java does not find the version.
My system reports java -version as:
          java version "1.7.0_b147-icedtea"

I changed line 110-113:

      IF(var MATCHES "java version \"[0-9]+\\.[0-9]+\\.[0-9_.]+[oem-]*\".*")
        # This is most likely Sun / OpenJDK, or maybe GCJ-java compat layer
        STRING( REGEX REPLACE ".* version \"([0-9]+\\.[0-9]+\\.[0-9_.]+)[oem-]*\".*"
                "\\1" Java_VERSION_STRING "${var}" )

TO:


      IF(var MATCHES "java version \"[0-9]+\\.[0-9]+\\.[0-9_.]+.*\".*")
        # This is most likely Sun / OpenJDK, or maybe GCJ-java compat layer
        STRING( REGEX REPLACE ".* version \"([0-9]+\\.[0-9]+\\.[0-9_.]+).*\".*"
                "\\1" Java_VERSION_STRING "${var}" )


And it happily reported the version as 1.7.0.

Thanks,
     Allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120612/706da286/attachment.htm>


More information about the CMake mailing list