universalJavaApplicationStub icon indicating copy to clipboard operation
universalJavaApplicationStub copied to clipboard

Search for embedded JREs

Open ebourg opened this issue 4 years ago • 1 comments

I'd like to suggested an enhancement that would consist in finding automatically a JRE embedded in the application. Something more flexible that setting the exact path to the JRE with the JAVA_HOME variable in Info.plist. The idea is that the application takes care of updating its JRE and the launcher finds out where it's located.

Currently I'm using a dedicated base directory (Contents/Resources/Java/jre) where the JREs are installed, there is always at least one subdirectory with a JRE, for example Contents/Resources/Java/jre/jre-8u282-macosx-x64/. The stub has been patched to look for a JRE in the jre directory:

# embedded JREs
if [ -d "${WorkingDirectory}/jre" ] ; then
	while read -r embeddedJRE; do
		embeddedJRE+="/bin/java"
		version=$(get_java_version_from_cmd "${embeddedJRE}")
		allJVMs+=("$version:$embeddedJRE")
	done < <(find "${WorkingDirectory}/jre" -type d -mindepth 1 -maxdepth 1)
	# unset for loop variables
	unset version
fi

This could probably be improved by making the base jre directory configurable. Also an embedded JRE could also be selected in priority over other alternatives.

ebourg avatar Feb 16 '21 22:02 ebourg

Hi @ebourg, thanks for your suggestion. That sounds like a reasonable feature request and I will look into it in the next couple of days...

tofi86 avatar Feb 20 '21 08:02 tofi86