Skip to content

Conversation

@nickbeattie
Copy link
Contributor

This pull request enhances the logic for determining the Java Runtime Environment (JRE) home in the ProcessWatcher class, prioritizing user-configured settings and improving fallback mechanisms. It also introduces a utility method to validate JDK paths. Below are the key changes:

Improvements to JRE home detection:

  • Added logic to prioritize the java.jdt.ls.java.home setting if explicitly configured by the user. If the configured path is invalid, a warning is logged, and fallback options are considered. (src/daemon/processWatcher.ts, src/daemon/processWatcher.tsL37-R74)
  • Extended fallback mechanisms to check the java.configuration.runtimes setting for a default runtime or the first available runtime if no default is set. (src/daemon/processWatcher.ts, src/daemon/processWatcher.tsL37-R74)
  • Retained the embedded JRE as the final fallback option if no valid JRE is found in user settings. (src/daemon/processWatcher.ts, [1] [2]

Utility method for JDK path validation:

  • Introduced a new private method isValidJpsPath to check if a given JDK path is valid by verifying its existence and the presence of the jps tool in the bin directory. (src/daemon/processWatcher.ts, src/daemon/processWatcher.tsR137-R151)

@nickbeattie
Copy link
Contributor Author

@microsoft-github-policy-service agree

@testforstephen
Copy link
Contributor

@nickbeattie thanks for your contribution. Could you help explain what issue you want to address with this PR?

@nickbeattie
Copy link
Contributor Author

The company I work for uses Santa for binary authentication. We need to provide a custom Java runtime so that we don't continuously get popups. This PR addresses that by using the alternative JDK/JREs provided by the Java plugin settings.

@testforstephen
Copy link
Contributor

What pop-ups are you seeing? The JRE lookup in src/daemon/processWatcher.ts is only used for a heartbeat check and shouldn’t affect any functionality.

@nickbeattie
Copy link
Contributor Author

The popup doesn't come from the plugin; it comes from Santa (link above in my previous comment). This causes an obstructive popup for our engineers.

Copy link
Contributor

@testforstephen testforstephen left a comment

Choose a reason for hiding this comment

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

@nickbeattie LGTM. thank you for contribution.

@testforstephen testforstephen merged commit 99645e1 into microsoft:main Jun 7, 2025
1 check passed
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.

2 participants