treasure-data / digdag

Workload Automation System
https://www.digdag.io/
Apache License 2.0
1.3k stars 221 forks source link

Java version detection in sh,bat #792

Open hiroyuki-sato opened 6 years ago

hiroyuki-sato commented 6 years ago

I wrote Java version detection script in bash and Windows. This script may help for setting specific Java version options.

muga commented 6 years ago

@hiroyuki-sato Oh, thank you. I'm catching what your script could be helped for? I'm now guessing you expect to use it for https://github.com/treasure-data/digdag/pull/790 but, please correct me.

hiroyuki-sato commented 6 years ago

@muga I've never tried Digdag on Java9 or 10 yet. I heard that Embulk needs an extra option in Java9 or above. https://github.com/embulk/embulk/issues/976

If Digdag support multiple Java versions (8~10), and java command require specific option in 9 and 10 only, this script may help.

java_ver=`java -fullversion 2>&1 | awk '{ print $NF }' | tr -d '"' `

case "$java_ver" in
  1.8*)  ;; # do nothing
  9*|10*) 
    extra_opts="--add-module .."
    ;;
  *) echo "Unsupported Java version"; exit 1 ;;
esac