Programming/Java(Spring)2018. 12. 28. 17:59

일단.. openJDK 11 버전 설치하고 git bash에서 버전 정보를 보니.. 아래와 같이 나온다.

$ java --version

openjdk 11.0.1 2018-10-16

OpenJDK Runtime Environment 18.9 (build 11.0.1+13)

OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode) 


근데 gradle 도움말에 보이는건.. java version 이라고 명시되네..

❯ java -version

java version "1.8.0_151"

Java(TM) SE Runtime Environment (build 1.8.0_151-b12)

Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode) 

[링크 : gradle-4.10.3/getting-started.html]


Note that version must be included in the -version output. Note that this is exactly the command that DefaultJvmVersionDetector parses the output of:


gradle/subprojects/jvm-services/src/main/java/org/gradle/internal/jvm/inspection/DefaultJvmVersionDetector.java


Line 53 in 8e399da


 builder.setCommandLine(javaCommand, "-version");  

[링크 : https://github.com/gradle/gradle/issues/4503]


그래서 소스를 뒤져보니

gradle-4.10.3\src\jvm-services\org\gradle\internal\jvm\inspection\DefaultJvmVersionDetector.java

    private JavaVersion parseJavaVersionCommandOutput(String javaExecutable, BufferedReader reader) {

        try {

            String versionStr = reader.readLine();

            while (versionStr != null) {

                Matcher matcher = Pattern.compile("(?:java|openjdk) version \"(.+?)\"( \\d{4}-\\d{2}-\\d{2}( LTS)?)?").matcher(versionStr);

                if (matcher.matches()) {

                    return JavaVersion.toVersion(matcher.group(1));

                }

                versionStr = reader.readLine();

            }

        } catch (IOException e) {

            throw new UncheckedIOException(e);

        }


        throw new GradleException(String.format("Could not determine Java version using executable %s.", javaExecutable));

    } 


아무래도.. matcher에서 version이 빠짐으로서 매치되는 버전을 찾을 수 없다고 배째게 되는게 아닐까 싶네..


+

centos 7에서 버전 바꾸어 가면서 해보는데 어라..

-version이랑 --version이랑 다르게 나온다?

$ sudo yum install java-11-openjdk.x86_64

$ java -version

openjdk version "11.0.1" 2018-10-16 LTS

OpenJDK Runtime Environment 18.9 (build 11.0.1+13-LTS)

OpenJDK Server VM 18.9 (build 11.0.1+13-LTS, mixed mode, sharing)

$ java --version

openjdk 11.0.1 2018-10-16 LTS

OpenJDK Runtime Environment 18.9 (build 11.0.1+13-LTS)

OpenJDK Server VM 18.9 (build 11.0.1+13-LTS, mixed mode, sharing)


$ sudo yum install java-1.8.0-openjdk.x86_64

$ java -version

openjdk version "1.8.0_191"

OpenJDK Runtime Environment (build 1.8.0_191-b12)

OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)  


'Programming > Java(Spring)' 카테고리의 다른 글

spring for android  (0) 2018.12.28
sts gradule spring boot howto  (0) 2018.12.28
spring classname.class  (0) 2018.12.27
gradle + STS + openJDK 설치 -_-  (0) 2018.12.27
gradle to buildship  (0) 2018.12.27
Posted by 구차니