Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How can a c++ program get the java version number.

ilantalSep 7 2008 — edited Sep 9 2008
To my dismay I discovered that much of the world has old java or no java.
Thus I need to write a simple c++ program, or even bat file - anything will do.
What I need it to do is the command:
java -version

If the output is: java version "1.6......"
the java is OK. Otherwise the program knows something is wrong and can do something else.
I thought this would be a piece of cake, but it isn't.

Basically I need to send the command and capture the output, which should be easy.
It isn't as easy as I thought it would be.

Are there any other ways to know what the version is (if it exists)?

Thanks,
Ilan
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 7 2008
Added on Sep 7 2008
16 comments
527 views