1.

Solve : DOS batch scripting to identify JAVA version?

Answer»

good DAY. I'm kinda new here. I want to ask if is there a way for a batch (.bat) file to retreive and parse the message of a java command (say "java -version").

then later on identify the type of version it reflected through a nested if STATEMENT? (e.g. if ERRORLEVEL == "1.4.2_12 goto lower).

I would appreciate if somebody could help me out with these.
Thank you very much.
I was able to redirect the STDERR STREAM to a file. For whatever reason, java did not SEEM to OUTPUT to STDOUT.

Code: [Select]@echo off
java -version 2> java.txt
for /f "tokens=3" %%x in ('find /i "java version" java.txt') do (
if %%~x==1.6.0_03 goto label3
if %%~x==1.6.0_02 goto label2
if %%~x==1.6.0_01 goto label1
if %%~x==1.4.2_12 goto label0
)
.
.
.
del java.txt



Discussion

No Comment Found