Java self-contained application with JRE included both for Windows and Linux

Hi,

I have a Java 17 application with its source code hosted on a GitLab repository. My company uses TeamCity for CI/CD, and it pulls the application from GitLab and builds it on a TeamCity Windows Agent.

I’ve set up build steps to create a JRE from the JDK installed on the Windows Agent (J-LINK), package it with my JAR file, and then prepare an executable file. This process works correctly on Windows, but now I need to do the same for Linux.

The challenge is that we only have Windows Agents on TeamCity, and I can't use external tools like AWS, GitLab, Azure, etc., to build the application or create the JRE.

Also I can't install any VM, WSL or Docker on that agent.

Is it possible to build a Java application that works on both Windows and Linux using only Windows Agents on TeamCity? If so, how can I achieve this?

Is there any workaround?

Thanks in advance, Waldemar

0
1 comment
Hi Waldemar,

If there is a way to package the JRE with a JAR file on a Windows machine in a way that will produce a package that can run on Linux, then it should be possible to do it in TeamCity. However, this is more of a general Java question, not a TeamCity-related question.
Please let us know if you find a way to do so. 
If you find such a method that will work on your Windows machine when done locally but encounter any questions when implementing it in TeamCity, we will be happy to help.

Best regards,
Anton
0

Please sign in to leave a comment.