[GH-ISSUE #53] Executable not found in path #29

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

Originally created by @aprasadh on GitHub (Aug 13, 2018).
Original GitHub issue: https://github.com/FiloSottile/mkcert/issues/53

I tried running mkcert version 1.1.0 in windows. I got the following error.

$ mkcert-v1.1.0-windows-amd64.exe example.org
Using the local CA at "C:\Users\XXXXX\AppData\Local\mkcert"
ERROR: failed to execute "keytool -list": exec: "": executable file not found in %PATH%

Originally created by @aprasadh on GitHub (Aug 13, 2018). Original GitHub issue: https://github.com/FiloSottile/mkcert/issues/53 I tried running `mkcert` version 1.1.0 in windows. I got the following error. > `$ mkcert-v1.1.0-windows-amd64.exe example.org` > `Using the local CA at "C:\Users\XXXXX\AppData\Local\mkcert"` > `ERROR: failed to execute "keytool -list": exec: "": executable file not found in %PATH%`
kerem closed this issue 2026-02-25 22:32:25 +03:00
Author
Owner

@ajsb85 commented on GitHub (Aug 13, 2018):

mkcert-v1.1.0-windows-amd64.exe -install
Using the local CA at "C:\Users\XXXXX\AppData\Local\mkcert" ✨
The local CA is now installed in the system trust store! ⚡️
Note: Firefox support is not available on your platform. ℹ️
ERROR: failed to execute "keytool -list": exec: "": executable file not found in %PATH%

keytool -list
keytool error: java.lang.Exception: Keystore file does not exist: C:\Users\alexa\.keystore
<!-- gh-comment-id:412471167 --> @ajsb85 commented on GitHub (Aug 13, 2018): ```console mkcert-v1.1.0-windows-amd64.exe -install Using the local CA at "C:\Users\XXXXX\AppData\Local\mkcert" ✨ The local CA is now installed in the system trust store! ⚡️ Note: Firefox support is not available on your platform. ℹ️ ERROR: failed to execute "keytool -list": exec: "": executable file not found in %PATH% keytool -list keytool error: java.lang.Exception: Keystore file does not exist: C:\Users\alexa\.keystore ```
Author
Owner

@daniellockard commented on GitHub (Aug 13, 2018):

That means you don't have java's keytool installed. Might want to install it.

<!-- gh-comment-id:412534118 --> @daniellockard commented on GitHub (Aug 13, 2018): That means you don't have java's `keytool` installed. Might want to install it.
Author
Owner

@aprasadh commented on GitHub (Aug 13, 2018):

I ran keytool -list and I got this

keytool error: java.lang.Exception: Keystore file does not exist: C:\Users\XXXXX\.keystore

<!-- gh-comment-id:412590626 --> @aprasadh commented on GitHub (Aug 13, 2018): I ran `keytool -list` and I got this `keytool error: java.lang.Exception: Keystore file does not exist: C:\Users\XXXXX\.keystore`
Author
Owner

@nickkaczmarek commented on GitHub (Aug 13, 2018):

I'm having the same issue and getting the same response as @aprasadh from "%JAVA_HOME%\bin\keytool.exe" -list as well as keytool -list. This isn't something I recall having to do for mkcert on macos or ubuntu.

<!-- gh-comment-id:412612252 --> @nickkaczmarek commented on GitHub (Aug 13, 2018): I'm having the same issue and getting the same response as @aprasadh from `"%JAVA_HOME%\bin\keytool.exe" -list` as well as `keytool -list`. This isn't something I recall having to do for mkcert on macos or ubuntu.
Author
Owner

@nickkaczmarek commented on GitHub (Aug 13, 2018):

@cretz Is this something you encountered in your local instance of mkcert? Seems to be looking for a java tool to created a keystore.

<!-- gh-comment-id:412642531 --> @nickkaczmarek commented on GitHub (Aug 13, 2018): @cretz Is this something you encountered in your local instance of mkcert? Seems to be looking for a java tool to created a keystore.
Author
Owner

@cretz commented on GitHub (Aug 13, 2018):

@nickkaczmarek - No it is not, and I use the JVM frequently. I didn't even know that added the root in my Java keystore, heh. This appears to be a new thing @adamdecaf added in #38. There appear to be some things wrong such as in its java check it calls keytool even if hasKeytool is false. Also, it assumes it's a JDK and not a JRE by its cert path lookup.

It's going to happen on all Windows OS's, because it looks for bin/keytool instead of bin/keytool.exe (Windows support was just merged after that). So someone needs to Windows-ify it, change the checkJava to stop assuming the keytool is there, and change the cert path lookup to respect JREs instead of just JDKs.

<!-- gh-comment-id:412656445 --> @cretz commented on GitHub (Aug 13, 2018): @nickkaczmarek - No it is not, and I use the JVM frequently. I didn't even know that added the root in my Java keystore, heh. This appears to be a new thing @adamdecaf added in #38. There appear to be some things wrong such as in its java check it calls keytool even if hasKeytool is false. Also, it assumes it's a JDK and not a JRE by its cert path lookup. It's going to happen on all Windows OS's, because it looks for `bin/keytool` instead of `bin/keytool.exe` (Windows support was just merged after that). So someone needs to Windows-ify it, change the checkJava to stop assuming the keytool is there, and change the cert path lookup to respect JREs instead of just JDKs.
Author
Owner

@nickkaczmarek commented on GitHub (Aug 13, 2018):

I saw that jre path also and thought it looked fishy. I ended up removing Java from my machine to get past it but fixing the project is probably a more sustainable route.

<!-- gh-comment-id:412666200 --> @nickkaczmarek commented on GitHub (Aug 13, 2018): I saw that jre path also and thought it looked fishy. I ended up removing Java from my machine to get past it but fixing the project is probably a more sustainable route.
Author
Owner

@adamdecaf commented on GitHub (Aug 13, 2018):

Yep. I missed that before, sorry. I don't have a windows machine to test with, but could y'all try this patch?

https://github.com/FiloSottile/mkcert/pull/54

<!-- gh-comment-id:412699672 --> @adamdecaf commented on GitHub (Aug 13, 2018): Yep. I missed that before, sorry. I don't have a windows machine to test with, but could y'all try this patch? https://github.com/FiloSottile/mkcert/pull/54
Author
Owner

@nickkaczmarek commented on GitHub (Aug 13, 2018):

@adamdecaf that might work, but I think the jre path might be problematic as well. I can take a look tomorrow if no one else does.

<!-- gh-comment-id:412700079 --> @nickkaczmarek commented on GitHub (Aug 13, 2018): @adamdecaf that might work, but I think the jre path might be problematic as well. I can take a look tomorrow if no one else does.
Author
Owner

@adamdecaf commented on GitHub (Aug 13, 2018):

Ah okay. If the install path for java (or the extracted file structure) is different for windows we can probably work around the differences.

<!-- gh-comment-id:412700252 --> @adamdecaf commented on GitHub (Aug 13, 2018): Ah okay. If the install path for java (or the extracted file structure) is different for windows we can probably work around the differences.
Author
Owner

@cretz commented on GitHub (Aug 13, 2018):

If the install path for java (or the extracted file structure) is different for windows

It's not. The difference is JRE vs JDK.

<!-- gh-comment-id:412701206 --> @cretz commented on GitHub (Aug 13, 2018): > If the install path for java (or the extracted file structure) is different for windows It's not. The difference is JRE vs JDK.
Author
Owner

@adamdecaf commented on GitHub (Aug 13, 2018):

That makes sense. Do you know if the structure is the same across OS's? We could just check for both paths.

<!-- gh-comment-id:412701752 --> @adamdecaf commented on GitHub (Aug 13, 2018): That makes sense. Do you know if the structure is the same across OS's? We could just check for both paths.
Author
Owner

@cretz commented on GitHub (Aug 13, 2018):

I believe so, yes

<!-- gh-comment-id:412702081 --> @cretz commented on GitHub (Aug 13, 2018): I believe so, yes
Author
Owner

@Suleman-Elahi commented on GitHub (Aug 14, 2018):

image

same here

<!-- gh-comment-id:412777173 --> @Suleman-Elahi commented on GitHub (Aug 14, 2018): ![image](https://user-images.githubusercontent.com/24384996/44076970-bfa85152-9fbf-11e8-86db-4fc0d1e2fcc2.png) same here
Author
Owner

@zanjs commented on GitHub (Aug 14, 2018):

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

me too

<!-- gh-comment-id:412804761 --> @zanjs commented on GitHub (Aug 14, 2018): `ERROR: failed to execute "keytool -list": exec: "": executable file not found in %PATH%` me too
Author
Owner

@nickkaczmarek commented on GitHub (Aug 14, 2018):

So @cretz, it looks like when you implemented the windows functionality, the java change was unnecessary for a CA to be created in windows. Is it worth allowing an opt out of using java? I'm not sure how the keystore works, but it seems to be unnecessary. @adamdecaf or @FiloSottile, what do you think about a java opt out? I really don't know how this works, but I'd prefer to have mkcert not use java even if it's installed on my machine.

<!-- gh-comment-id:412856913 --> @nickkaczmarek commented on GitHub (Aug 14, 2018): So @cretz, it looks like when you implemented the windows functionality, the java change was unnecessary for a CA to be created in windows. Is it worth allowing an opt out of using java? I'm not sure how the keystore works, but it seems to be unnecessary. @adamdecaf or @FiloSottile, what do you think about a java opt out? I really don't know how this works, but I'd prefer to have mkcert not use java even if it's installed on my machine.
Author
Owner

@adamdecaf commented on GitHub (Aug 14, 2018):

Why would we opt out of java? It's been useful at a previous employer to add the company CA into the truststore.

<!-- gh-comment-id:413051343 --> @adamdecaf commented on GitHub (Aug 14, 2018): Why would we opt out of java? It's been useful at a previous employer to add the company CA into the truststore.
Author
Owner

@nickkaczmarek commented on GitHub (Aug 14, 2018):

I was referring to having the option to choose to not use it when generating a CA or certificate. My knowledge is really lacking around what mkcert really does so forgive me if I'm super off base and my specific use case is to generate certificates for local development. I'm simply saying that this worked without using Java when @cretz added windows support so in theory it should work without using Java and therefore possible to pass an option to not use Java when installing a CA or creating certificates.

Edit:
So for instance, allow a user to pass an option to use the native truststore rather than the java one, even if the JAVA_HOME environment variable is set. I'm looking into how this can be done because I have to have java installed on my work machine, but I'd rather use the native truststore to handle this action.

<!-- gh-comment-id:413052247 --> @nickkaczmarek commented on GitHub (Aug 14, 2018): I was referring to having the option to choose to not use it when generating a CA or certificate. My knowledge is really lacking around what mkcert really does so forgive me if I'm super off base and my specific use case is to generate certificates for local development. I'm simply saying that this worked without using Java when @cretz added windows support so in theory it should work without using Java and therefore possible to pass an option to not use Java when installing a CA or creating certificates. Edit: So for instance, allow a user to pass an option to use the native truststore rather than the java one, even if the `JAVA_HOME` environment variable is set. I'm looking into how this can be done because I have to have java installed on my work machine, but I'd rather use the native truststore to handle this action.
Author
Owner

@FiloSottile commented on GitHub (Aug 15, 2018):

To be clear, when JAVA_HOME is set, both the Java and the system trust stores have the certificate installed. Would you still want to selectively disable that, even if this issue was fixed? If so, please open a separate issue for that feature request.

<!-- gh-comment-id:413056662 --> @FiloSottile commented on GitHub (Aug 15, 2018): To be clear, when `JAVA_HOME` is set, both the Java and the system trust stores have the certificate installed. Would you still want to selectively disable that, even if this issue was fixed? If so, please open a separate issue for that feature request.
Author
Owner

@nickkaczmarek commented on GitHub (Aug 15, 2018):

In that case, no. I got around this pre @adamdecaf suggested fix by removing JAVA_HOME and some other path specific stuff so this could give me an opportunity to see what a fresh install of java installs and sets so I could contribute to what @adamdecaf is working on in #54. I'm not sure having the option to selectively disable the java truststore step is necessary if it works because my impression is these truststore files are OS specific and the only reason to have the opt-out capability would be for this particular use case.

<!-- gh-comment-id:413057869 --> @nickkaczmarek commented on GitHub (Aug 15, 2018): In that case, no. I got around this pre @adamdecaf suggested fix by removing `JAVA_HOME` and some other path specific stuff so this could give me an opportunity to see what a fresh install of java installs and sets so I could contribute to what @adamdecaf is working on in #54. I'm not sure having the option to selectively disable the java truststore step is necessary if it works because my impression is these truststore files are OS specific and the only reason to have the opt-out capability would be for this particular use case.
Author
Owner

@nickkaczmarek commented on GitHub (Aug 15, 2018):

In any case, I have this working on my mac at home and windows pc at work and I'm so glad there is such a simple tool to do this. I've seen there are others, but this piques my interest especially since it's written in go.

<!-- gh-comment-id:413058011 --> @nickkaczmarek commented on GitHub (Aug 15, 2018): In any case, I have this working on my mac at home and windows pc at work and I'm so glad there is such a simple tool to do this. I've seen there are others, but this piques my interest especially since it's written in go.
Author
Owner

@nickkaczmarek commented on GitHub (Aug 15, 2018):

@FiloSottile @adamdecaf I don't know if this is the correct way of doing it, but as a stop gap for the people experiencing this issue until @adamdecaf has #54 finished and accepted, the temporary solution seems to be delete or rename JAVA_HOME and run mkcert -install and mkcert hostname again.

<!-- gh-comment-id:413063379 --> @nickkaczmarek commented on GitHub (Aug 15, 2018): @FiloSottile @adamdecaf I don't know if this is the correct way of doing it, but as a stop gap for the people experiencing this issue until @adamdecaf has #54 finished and accepted, the temporary solution seems to be delete or rename `JAVA_HOME` and run `mkcert -install` and `mkcert hostname` again.
Author
Owner

@FiloSottile commented on GitHub (Aug 19, 2018):

Thanks everyone, let me know if v1.1.1 fixes this.

<!-- gh-comment-id:414162839 --> @FiloSottile commented on GitHub (Aug 19, 2018): Thanks everyone, let me know if v1.1.1 fixes this.
Author
Owner

@wikijm commented on GitHub (Aug 23, 2018):

For Windows installation, you can use those commands:

REM Define %JAVA_HOME% variable
    for /d %%i in ("\Program Files\Java\jdk*") do set JAVA_HOME=%%i

REM Add %JAVA_HOME% VARIABLE to %PATH% variable
    setx PATH "%JAVA_HOME%\bin";"%PATH%" -m
<!-- gh-comment-id:415527944 --> @wikijm commented on GitHub (Aug 23, 2018): For Windows installation, you can use those commands: ```batch REM Define %JAVA_HOME% variable for /d %%i in ("\Program Files\Java\jdk*") do set JAVA_HOME=%%i REM Add %JAVA_HOME% VARIABLE to %PATH% variable setx PATH "%JAVA_HOME%\bin";"%PATH%" -m ````
Author
Owner

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

I had the same issue today on Mojave.

I ended up manually running keytool to kick it into action by doing keytool -genkeypair which fixed the keytool error: java.lang.Exception: Keystore file does not exist error.

However then still had the odd JAVA_HOME issue - I used a pretty dodgy workaround and added an bash alias of alias mkcert="unset JAVA_HOME && mkcert"

So just for that terminal session it would unset it - and it seems to then work!

<!-- gh-comment-id:433604340 --> @OwenMelbz commented on GitHub (Oct 27, 2018): I had the same issue today on Mojave. I ended up manually running keytool to kick it into action by doing `keytool -genkeypair` which fixed the `keytool error: java.lang.Exception: Keystore file does not exist` error. However then still had the odd JAVA_HOME issue - I used a pretty dodgy workaround and added an bash alias of `alias mkcert="unset JAVA_HOME && mkcert"` So just for that terminal session it would unset it - and it seems to then work!
Author
Owner

@noway commented on GitHub (Apr 7, 2022):

unset JAVA_HOME did the trick for me

<!-- gh-comment-id:1092271118 --> @noway commented on GitHub (Apr 7, 2022): `unset JAVA_HOME` did the trick for me
Author
Owner

@pedrovgs commented on GitHub (Jul 6, 2022):

I just deleted JAVA_HOME env var and it just worked like a charm. Thanks!

<!-- gh-comment-id:1176228438 --> @pedrovgs commented on GitHub (Jul 6, 2022): I just deleted JAVA_HOME env var and it just worked like a charm. Thanks!
Author
Owner

@Herz3h commented on GitHub (Nov 17, 2023):

ty @pedrovgs

<!-- gh-comment-id:1816493653 --> @Herz3h commented on GitHub (Nov 17, 2023): ty @pedrovgs
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#29
No description provided.