Enforcing Java minimum version to run with "java -version:<value>" doesn't work on Windows -
i want enforce minimum version of jvm application should run on 1.6 or greater (i.e. 1.6+). understanding can using "-version:" command line argument. tried it, , seemed work fine under linux not under windows.
linux
i have jdk version 1.6.0_21 installed on linux machine. $java_home , $path environment variables have been set should be.
i ran following:
$ java -version:1.6+ -version java version "1.6.0_21" java(tm) se runtime environment (build 1.6.0_21-b06) java hotspot(tm) 64-bit server vm (build 17.0-b16, mixed mode) $ java -version:1.5+ -version java version "1.6.0_21" java(tm) se runtime environment (build 1.6.0_21-b06) java hotspot(tm) 64-bit server vm (build 17.0-b16, mixed mode) $ java -version:1.7+ -version unable locate jre meeting specification "1.7+"
all seemed expected. "version:1.6+" , "version:1.5+" should work because have jdk 1.6.0_21 installed, , "version:1.7+" shouldn't because don't have jdk 1.7 installed.
windows
i have same jdk version 1.6.0_21 installed on windows machine (windows 7 more specific). %java_home% , %path% environment variables have been set should be.
i ran following:
$ java -version:1.6+ -version unable locate jre meeting specification "1.6+" $ java -version:1.5+ -version unable locate jre meeting specification "1.5+" $ java -version:1.7+ -version unable locate jre meeting specification "1.7+"
i got error each execution.
can explain why same command line argument work on linux, not on windows? feature or bug?
what can fix/work around it? as possible want have same command line arguments applied on both linux , windows, don't have specify different "-version:" argument linux , different 1 windows.
thanks.
- can explain why same command line argument work on linux, not on windows? feature or bug?
i don't think related linux vs. windows, rather issue particular distributions - can run fine on windows oracle jdk now, i.e. successor of sun jdk (both via powershell or cmd):
ps> java -version:1.7+ -version java version "1.7.0_45" java(tm) se runtime environment (build 1.7.0_45-b18) java hotspot(tm) 64-bit server vm (build 24.45-b08, mixed mode)
on contrary, fails me on ubuntu 12.04 lts openjdk:
$ java -version java version "1.7.0_51" openjdk runtime environment (icedtea 2.4.4) (7u51-2.4.4-0ubuntu0.12.04.2) openjdk 64-bit server vm (build 24.45-b08, mixed mode) $ java -version:1.7+ -version error: unable locate jre meeting specification "1.7+"
a short search reveals following inconclusive issues:
- java -version:release option not work documented (jdk-8011079)
- the referenced link broken, current 1 https://blogs.oracle.com/ksrini/entry/java_launcher_tricks_with_multiple; regardless, fail see how referenced docs address issue though.
- java -version:1.6+ refuses work (jdk-6558219)
- this seems hint on distribution specifics, , indeed there java -version:spec not work (#1050911) ubuntu 12.04 lts
i've confirmed still broken openjdk 6/7 on ubuntu 13.10 , on amazon linux 2013.09.2, suggest experiment different openjdk distribution or jdk vendor, in case issue prevalent - it's odd issue, esp. given openjdk meanwhile official java se 7 reference implementation.
Comments
Post a Comment