Skip to content

Commit f554d0b

Browse files
authored
Update TROUBLESHOOTING.md
1 parent d57275b commit f554d0b

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

docs/dev-notes/TROUBLESHOOTING.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,38 +22,37 @@ Navigate to:
2222

2323
For step-by-step instructions, [refer to this answer](https://stackoverflow.com/a/79049864/1771663).
2424

25-
**2. List installed JDKs**
25+
**2. Configure CLI to use JDK 17**
2626

27-
To identify installed JDK versions:
28-
```bash
29-
/usr/libexec/java_home -V
30-
```
27+
To avoid Gradle failures in CLI, ensure that **JDK 17** is used consistently during local development. This can be done by updating `JAVA_HOME` environment variable, either temporarily (for current session only) or permanently (via shell profile).
3128

32-
**3. Configure CLI to use JDK 17**
29+
**Option 1: Use a specific JDK path or dynamic lookup**
3330

34-
Update shell profile (`~/.zshrc`, `~/.bash_profile`, etc.) to ensure the CLI uses JDK 17 for all Gradle tasks.
31+
Choose either of the following, depending on preference:
32+
33+
- Set a known JDK 17 path (use `/usr/libexec/java_home -V` to list installed versions):
3534

36-
- **Option 1:** Set the path explicitly
37-
(Use this if a specific JDK 17 path is known or was listed in Step 2. The example path below may differ.)
3835
```bash
3936
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jbr-17.0.14.jdk/Contents/Home"
4037
export PATH="$JAVA_HOME/bin:$PATH"
4138
```
4239

43-
- **Option 2:** Use latest installed JDK 17 dynamically
40+
- Or use dynamic lookup to always pick latest installed JDK 17:
41+
4442
```bash
4543
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
4644
export PATH="$JAVA_HOME/bin:$PATH"
4745
```
4846

49-
**4. Apply the environment change**
47+
These commands can be:
48+
- **Temporary:** Run directly in the terminal for one session
49+
- **Permanent:** Add to shell profile like `~/.zshrc` or `~/.bash_profile` _- Restart the terminal or run `source ~/.zshrc` (or appropriate file) to apply the changes_
5050

51-
Run following command or restart the terminal:
52-
```bash
53-
source ~/.zshrc # or source ~/.bash_profile
54-
```
51+
**Option 2: Use a Java version manager**
52+
53+
Tools like [jenv](https://github.com/jenv/jenv) can simplify managing multiple JDK versions across projects. This document doesn't cover setup details, but can be worth considering for long-term convenience.
5554

56-
**5. Verify the JDK version used by Gradle**
55+
**3. Verify the JDK version used by Gradle**
5756

5857
Confirm that the CLI uses JDK 17 by running:
5958
```bash

0 commit comments

Comments
 (0)