Sign in to follow this  

Extracting Java Version via CMD

Recommended Posts

CPressland    176


I'm currently working on migrating versions of Java to the latest build and am currently trying to do some custom reporting back to my Inventory Server; currently on OS X I'm running a shell script which looks like this:

/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version 2>&1 | grep "java version" | awk '{print $3}' | sed -e "s/\"//g"


This exports code which looks like this:


So what I need is a Batch Script which will do the exact same on Windows. Any ideas?

Share this post

Link to post
Share on other sites
CPressland    176

Just in case anybody in the future needs this:

@echo off

set VERSION6="1.6.0_21"
for /f "tokens=3" %%g in ('java -version 2^>^&1 ^| findstr /i "version"') do (
set JAVAVER=%%g
@echo %JAVAVER%
@exit %JAVAVER%

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.