Java support on Windows

I wanted to test the Windows Early Release but it seems it’s way too early:

The language 'java' is currently unsupported on the Windows Build Environment.

Please add support for Java.

9 Likes

For now, you may resort to language: shell and either use a pre-installed JDK ( where it is installed, i don’t know, if you find, please tell me here: https://travis-ci.community/t/paths-to-pre-installed-tools ) or use chocolatey to install an Oracle JDK: https://chocolatey.org/packages/jdk10 or https://chocolatey.org/packages/jdk11

Really looking forward to this being supported officially!

With the custom way from @sormuras can that work with existing configurations that already use language: java? This is the one I’m using https://github.com/UniversalMediaServer/UniversalMediaServer/blob/master/.travis.yml

1 Like

My situation is slightly different. I’m not trying to use java as a language, but instead 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. I’ve tried installing java using chocolately, as noted above, which seems to work, but java 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 (except powershell), followed by RefreshEnv, none of which work. Any ideas for how I get java’s bin path in to PATH? Or should I post this as a new topic? Or is there something else I need to do to “activate” java?

Hi guys,

I was able to install and use Java on Travis for Windows.
Take a look at this build as an example (see .travis.yml too)

I have scripted the installation to be able to use this across multi jobs for my project : https://github.com/portapps/portapps/tree/master/.travis

Hope this help!

1 Like

Hi, I’m using your methods to try, but failed during ‘before_install’ step. The build failed with no error message when trigger java.sh. Can you suggest why this happened? Thx.

Do you have a link to your build ?

Fyi java.sh is an embedded script of my own, not a travis one. Here is the content :

export JAVA_HOME=${JAVA_HOME:-/c/jdk}
export PATH=${JAVA_HOME}/bin:${PATH}
choco install jdk8 -params 'installdir=c:\\jdk' -y

Thanks Max.

1 Like

I noticed today that my Java build worked under both Linux and OS X but failed under Windows because a configuration file for static code analysis defined a file to be ignored in a way that is not understood under Windows. I tried to add Windows to my existing Travis configuration to notice such things in the future but came across the error message:

The language ‘java’ is currently unsupported on the Windows Build Environment. Let us know if you’d like to see it: Windows - Travis CI Community. Thanks for understanding!

From: Travis CI - Test and Deploy with Confidence

So, I’d like to ask for Java as part of the Travis Windows build environment. Keep up the good work and thanks for providing Travis to the community in the first place,

Marco

+1 Travis

I’m also very much interested in seeing official Java support on Windows builds. This would allow us to build our deployment bundles way more easily.

1 Like

While it’s not officially supported, you may look at Gravis-CI

2 Likes

I also add my interest in officially supporting Java builds on Windows.

+1, please add this TravisCI.

+1 it’s always better to check os compatibilities

+1, this would be a good feature to add