How to change JAVA_HOME value in generated bat/shell script from 'application' plugin?

I use ‘application’ plugin to create executable scripts for both Windows and Linux platforms.

For Linux platform (where we deploy our product) the JAVA_HOME environment variable is set but there is no such directory called $JAVA_HOME/bin where the generated scripts are looking for the java.

Actually java binary exists at path $JAVA_HOME/jre/bin. (To be clear we don’t have JDK installed on the product but only JRE, weird folder structure :slight_smile: )

I can manually modify the generated shell script to make it workable. But is there any way to fix the value from gradle file, so that I don’t need to modify it manually and get the working shell scripts just bu gradle task itself?

Changing the value of JAVA_HOME environment variable is not possible for my product as that path is in use by many scripts.

1 Like