You are not logged in.

#1 2015-11-27 16:09:48

random-access
Member
Registered: 2015-11-27
Posts: 3

Build package for Java application - Java version & library location

Hi, I'm quite new to packaging (trying to package my 2nd application) and have some questions regarding java versions:

If i add java-environment>=1.8 as a runtime dependency to a PKGBUILD a user could have additionally installed JDK 8 or higher but set JDK7 or something else as default, right?

So if an application requires JDK8 or higher, I assume that I must provide the path to a correct Java version in the startup script.

As far as I understood I get a list of installed java versions from archlinux-java status, which have all corresponding folders in /usr/lib/jvm, and with archlinux-java get I get the default java version, so right now I'm doing the check like this:

## Get path to a JDK >= 8. If default JDK does not match, choose the first ##
## match from "archlinux-java status" list ##
default_java_version=`archlinux-java get | sed 's/[^0-9]//g'`
if [ "$default_java_version" -ge 8 ]
then
    JDK_PATH="/usr/lib/jvm/default"
    echo "JDK PATH (default): "$JDK_PATH
else
    java_versions=`archlinux-java status | grep -oe java-[8-9]-[a-z]*`
    JDK_PATH="/usr/lib/jvm/"`echo $java_versions | cut -f 1 -d " "`
    echo "JDK PATH (other): "$JDK_PATH
fi 

I was just wondering if there is a simpler way to list all Java versions, filter out the ones that don't fit and choose the path to a correct version?

My second question is about library location:

https://wiki.archlinux.org/index.php/Ja … guidelines recommends to put libraries in /usr/share/java/<application-name> but if I check this directory at my computer, there is only 1 jar file in it, and this jar is not in a folder at all.
Should I still put all jar files there, or just put everything in /opt?

Offline

Board footer

Powered by FluxBB