Minimum required java version


#1

I have 3 java programs available in the AUR and with Java 9 released there is a small problem.
I made my first package with inspiration from another java program in the AUR and used much of its structure, including the java version check, a check that will fail for Java 9.

So my question is, is there a really really good way to check for a minimum and possible maximum java version?

#!/bin/sh
if ! /usr/bin/java -version 2>&1 | grep 'version "1.8' >/dev/null
then
	echo "mapollage requires Java 8" >&2
	exit 1
fi
#unset JAVA_TOOL_OPTIONS
exec /usr/bin/java -jar '/usr/share/java/mapollage/mapollage.jar' "$@"

#2

Where is run the java version check? I might not completely understood the question

For a PKGBUILD I would like to use this for example

depends=(‘java-environment>=7’
‘java-environment<9’)

Require Java 7 or 8 but not 6 or 9


#3

Thank you!
Today, in https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=mapollage I have
depends=(‘java-runtime=8’) but I will change that.
Is there a good way to check the java version in the shell script too?


#4

That is beyond my knowledge


#5

You’ve already got a version check in the shell script. It will work fine.


#6

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.