NativeScript / NativeScript/nativescript-cli

OpenJDK 18 - JAVAC Fails this check

Open
#5,668 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.1k
Forks
204
Avg merge
1d 9h
Merged PRs (30d)
8

Description

Issue Description

ns doctor or ns build android will fail on later versions of OpenJDK installations (basically failing to detect that it is installed, because the version check fails to get a number version). Giving you an error message about javac not installed or JAVA_HOME not being set.

This line has the failing regex.
https://github.com/NativeScript/nativescript-cli/blob/e44ca94cce733be5925988d07a8f99e0acc692c9/packages/doctor/src/sys-info.ts#L15

Replaced in my local copy with:
SysInfo.JAVA_COMPILER_VERSION_REGEXP = /^javac (\d*)/im;
Changed the (.*) to (\d*) meaning grab all numbers...

Reproduction
  1. Install Ubuntu 22.04,
  2. install OpenJDK 18,
  3. install NativeScript,
  4. run NS doctor
Relevant log output (if applicable)

No response

Environment

echo $JAVA_HOME -> /usr/lib/jvm/java-18-openjdk-amd64
javac -version -> javac 18-ea

OS: Linux 5.17 Pop!_OS 22.04 LTS
Shell: /bin/bash
node: 16.15.0
npm: 8.5.5
nativescript: 8.2.3

android

java: javac 18-ea
ndk: Not Found
apis: 23, 24, 25, 26, 27, 28, 29, 30, 31, 32
build_tools: 30.0.0, 30.0.3, 33.0.0, 33.0.0

Please accept these terms

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/doctor/src/sys-info.ts at the failing Java compiler version regular expression. Reproduce the issue with OpenJDK 18 by running ns doctor or ns build android, then verify that javac 18-ea is detected instead of reported missing. The issue is done when the version check works for this output without regressing existing Java detection.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, typescript
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.