JDK Not Installed or Not On Path

I’m testing a nodejs app in a Windows environment. The app I’m testing relies on java for one of its functions. That function uses a child process to call java -version to make sure java is installed on the machine and on the PATH, and that call consistently fails. The documentation for Travis’ Windows environment says jdk8 and jdk10 are both installed, but they are not on the path, and so inaccessible. I’ve tried installing java using chocolately, as noted in this forum post, and the jdk install seems to work (the log says it did), but java still doesn’t appear on the PATH (though the install log says PATH has been changed), even after calling chocolatey’s RefreshEnv.cmd. I’ve tried to change the PATH using every way I can think of (including powershell, though I’m not all that skilled with powershell and may be doing something wrong), followed by RefreshEnv, none of which work. Any ideas on how I get the path to java’s bin in to PATH? Or is there something else I need to do to “activate” java?

Thanks!

Thanks for reaching out and I’m sorry for the troubles.

After looking into it, it seems that no JDK is pre-installed on our Windows images right now. We’ll update our documentation shortly. Sorry for the inconvenience.

I was able to install jdk8 and update the PATH environment variable accordingly by adding the following recipe in your .travis.yml file:

- choco install jdk8
- export PATH=$PATH:"/c/Program Files/Java/jdk1.8.0_191/bin"
- java -version

Could you try this out and let me know if it helps?

Thanks!

Once I got rid of all my typos in the .yml file :roll_eyes:, it worked great and the test I was focusing on passed. Now I just have to figure out why one of the others keeps failing. :wink:

Thanks Dominic!

Jill

Great news! And happy debugging! :crossed_fingers: