[GH-ISSUE #84] installJava fails on Windows #48

Closed
opened 2026-02-25 22:32:28 +03:00 by kerem · 7 comments
Owner

Originally created by @philippbeckmann on GitHub (Oct 26, 2018).
Original GitHub issue: https://github.com/FiloSottile/mkcert/issues/84

mkcert.exe -install with set JAVA_HOME fails with following error:

ERROR: failed to execute "keytool -importcert": exec: "sudo": executable file not found in %PATH%

Originally created by @philippbeckmann on GitHub (Oct 26, 2018). Original GitHub issue: https://github.com/FiloSottile/mkcert/issues/84 `mkcert.exe -install` with set JAVA_HOME fails with following error: `ERROR: failed to execute "keytool -importcert": exec: "sudo": executable file not found in %PATH%`
kerem closed this issue 2026-02-25 22:32:28 +03:00
Author
Owner

@adamdecaf commented on GitHub (Oct 27, 2018):

Are you running mkcert.exe inside Windows Subsystem for Linux (WSL)?

<!-- gh-comment-id:433587146 --> @adamdecaf commented on GitHub (Oct 27, 2018): Are you running `mkcert.exe` inside Windows Subsystem for Linux (WSL)?
Author
Owner

@philippbeckmann commented on GitHub (Oct 27, 2018):

@adamdecaf No, i'm using the more common cmd.exe or Powershell on Windows.

<!-- gh-comment-id:433636426 --> @philippbeckmann commented on GitHub (Oct 27, 2018): @adamdecaf No, i'm using the more common `cmd.exe` or Powershell on Windows.
Author
Owner

@adamdecaf commented on GitHub (Oct 27, 2018):

Are you running the windows binary from the releases page? The windows binary doesn't have code using sudo.

<!-- gh-comment-id:433643739 --> @adamdecaf commented on GitHub (Oct 27, 2018): Are you running the windows binary from the releases page? The windows binary doesn't have code using `sudo`.
Author
Owner

@philippbeckmann commented on GitHub (Oct 27, 2018):

I am using this one: mkcert-v1.1.2-windows-amd64.exe

The sudo is in truststore_java.go@L113

<!-- gh-comment-id:433653457 --> @philippbeckmann commented on GitHub (Oct 27, 2018): I am using this one: [mkcert-v1.1.2-windows-amd64.exe](https://github.com/FiloSottile/mkcert/releases/download/v1.1.2/mkcert-v1.1.2-windows-amd64.exe) The `sudo` is in [truststore_java.go@L113](https://github.com/FiloSottile/mkcert/blob/fcebdc9845560b3945005932dfc0651ac06d6b98/truststore_java.go#L113)
Author
Owner

@adamdecaf commented on GitHub (Oct 27, 2018):

Oh you're totally right. My bad. Can you try out this PR? https://github.com/FiloSottile/mkcert/pull/85

<!-- gh-comment-id:433657751 --> @adamdecaf commented on GitHub (Oct 27, 2018): Oh you're totally right. My bad. Can you try out this PR? https://github.com/FiloSottile/mkcert/pull/85
Author
Owner

@philippbeckmann commented on GitHub (Oct 30, 2018):

The sudo is gone, but the destination file <JDK>\lib\security\cacerts is not writeable by a normal user.

I had a brief look at this issue and it seems the only way to run a command elevated is by using ShellExecute with the verb runas.

Alternativly, a manifest file can be added to require elevation on invoking mkcert (certainly not desirable, as there are many functions usable without elevation)

Option 3 would be to just fail and instruct the user to run mkcert elevated.

<!-- gh-comment-id:434376652 --> @philippbeckmann commented on GitHub (Oct 30, 2018): The `sudo` is gone, but the destination file `<JDK>\lib\security\cacerts` is not writeable by a normal user. I had a brief look at this issue and it seems the only way to run a command elevated is by using `ShellExecute` with the verb `runas`. Alternativly, a manifest file can be added to require elevation on invoking `mkcert` (certainly not desirable, as there are many functions usable without elevation) Option 3 would be to just fail and instruct the user to run `mkcert` elevated.
Author
Owner

@adamdecaf commented on GitHub (Nov 3, 2018):

I recall it being a common pattern to "Run as Administrator" on Windows. If that's still around then that sounds fine.

<!-- gh-comment-id:435550375 --> @adamdecaf commented on GitHub (Nov 3, 2018): I recall it being a common pattern to "Run as Administrator" on Windows. If that's still around then that sounds fine.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/mkcert#48
No description provided.