Skip to content

fix: JDK version check wouldn't detect JDK 8 correctly - #1395

Merged
grabbou merged 1 commit into
react-native-community:masterfrom
liamjones:fix-jdk-version-check
Jul 6, 2021
Merged

grabbou merged 1 commit into
react-native-community:masterfrom
liamjones:fix-jdk-version-check

Conversation

@liamjones

Copy link
Copy Markdown
Contributor

Summary:

envinfo uses javac -version to work out the JDK version number. The doctor command was looking for a semver range of >= 8 but this won't work for JDK 8 as it uses the old style numbering scheme (e.g. 1.8.x not 8.x.x). JDKs 9+ use the new version numbering scheme.

Fixes #1255

Test Plan:

On macOS, before applying this PR's changes:

  • brew install openjdk@8
  • export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
  • Confirm javac -version outputs something like javac 1.8.0_282
  • react-native doctor

Observe doctor complains about the JDK version:

Android
 ✖ JDK
   - Version found: 1.8.0_282
   - Version supported: >= 8

Apply changes and run react-native doctor again, observe 8 is now correctly detected as supported:

Android
 ✓ JDK

Repeat the above steps with JDK 9+ to confirm they're still correctly detected.

`envinfo` uses `javac -version` to work out the JDK version number. The doctor command was looking for a semver range of `>= 8` but this won't work for JDK 8 as it uses the old style numbering scheme (e.g. `1.8.x` not `8.x.x`). JDKs 9+ use the new version numbering scheme.

Fixes react-native-community#1255
@liamjones
liamjones force-pushed the fix-jdk-version-check branch from bb900bf to 8852345 Compare April 5, 2021 12:25

@grabbou grabbou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Looks good!

@grabbou
grabbou merged commit 2e177dc into react-native-community:master Jul 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cli doctore does not recognize Java 8

2 participants