Skip to content

Check if system Java is installed#52

Merged
jonpryor merged 1 commit intomasterfrom
check-system-java-installed
Dec 11, 2018
Merged

Check if system Java is installed#52
jonpryor merged 1 commit intomasterfrom
check-system-java-installed

Conversation

@bratsche
Copy link
Copy Markdown
Contributor

@bratsche bratsche commented Dec 3, 2018

This checks for /System/Library/Java/JavaVirtualMachines if we're
trying to use the system java. If there is no system Java installed
then calling /usr/bin/java has the unfortunate effect of popping up
a dialog telling the user to install a JDK.

Fixes VSTS #735545

https://devdiv.visualstudio.com/DevDiv/_workitems/edit/735545

This checks for /System/Library/Java/JavaVirtualMachines if we're
trying to use the system java. If there is no system Java installed
then calling /usr/bin/java has the unfortunate effect of popping up
a dialog telling the user to install a JDK.

Fixes VSTS #735545
@bratsche bratsche requested a review from jonpryor December 3, 2018 18:33
@sgmunn
Copy link
Copy Markdown

sgmunn commented Dec 11, 2018

@jonpryor thoughts? this is associated with a blocker bug on VSM.

@sgmunn
Copy link
Copy Markdown

sgmunn commented Dec 11, 2018

@monojenkins backport d15-9

@jonpryor jonpryor merged commit 4c00c22 into master Dec 11, 2018
@jonpryor
Copy link
Copy Markdown
Contributor

@monojenkins backport d15-9

jonpryor pushed a commit that referenced this pull request Dec 11, 2018
Fixes: http://work.devdiv.io/735545

When Visual Studio for Mac is installed on a "clean" machine which
doesn't have a Java installed, two dialog boxes about Java are shown
when launching Visual Studio for Mac:

> To use the "java" command-line tool you need to install a JDK.

This happens because `java` is found via `$PATH`
(`JdkInfo.GetPathEnvironmentJdkPaths()`) -- because `/usr/bin/java`
exists -- but the `java` which is available is "bad", because
executing `java` results in the aforementioned dialog box.

Avoid calling `java` from `JdkInfo.GetPathEnvironmentJdkPaths()`
by introducing a macOS-specific check *requiring* that
`/System/Library/Java/JavaVirtualMachines` both *exist* and contain
*sub-directories* before `/usr/bin/java` or `java` are executed.
@bratsche
Copy link
Copy Markdown
Contributor Author

@jonpryor Here's a 15.9 backport #53

@bratsche bratsche deleted the check-system-java-installed branch December 11, 2018 20:40
@bratsche
Copy link
Copy Markdown
Contributor Author

@monojenkins backport d16-0

jonpryor pushed a commit that referenced this pull request Dec 12, 2018
Fixes: http://work.devdiv.io/735545

When Visual Studio for Mac is installed on a "clean" machine which
doesn't have a Java installed, two dialog boxes about Java are shown
when launching Visual Studio for Mac:

> To use the "java" command-line tool you need to install a JDK.

This happens because `java` is found via `$PATH`
(`JdkInfo.GetPathEnvironmentJdkPaths()`) -- because `/usr/bin/java`
exists -- but the `java` which is available is "bad", because
executing `java` results in the aforementioned dialog box.

Avoid calling `java` from `JdkInfo.GetPathEnvironmentJdkPaths()`
by introducing a macOS-specific check *requiring* that
`/System/Library/Java/JavaVirtualMachines` both *exist* and contain
*sub-directories* before `/usr/bin/java` or `java` are executed.
jonathanpeppers added a commit that referenced this pull request Mar 4, 2026
New findings:

- `#52`: Never use null-forgiving operator (!)
- `#53`: Add overloads to reduce caller ceremony
- `#54`: Delete unused overloads
- `#55`: Prefer C# pattern matching
- `#56`: Section-separator comments are `#region` in disguise

Updated `review-rules.md`: extended `#region` ban to cover banner
comments, added null-forgiving `!` as AI anti-pattern, added overload
and pattern matching rules to API Design section.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

3 participants