Find The Java Version using C++

I want to write a program in C++ to find the java version from the sys

Page 1 of 1

3 Replies - 2284 Views - Last Post: 26 October 2007 - 09:46 AM Rate Topic: -----

#1 Rajendra_Sahoo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 26-October 07

Find The Java Version using C++

Posted 26 October 2007 - 12:12 AM

Hi Sir,
I want to write a program in C++ to find the java version from the system,if java is not loaded in the system then it will show the relevant message like "Java is not loaded in that system"
if java is loaded then it will show the corresponding message that java is loaded in that system and it will also show the java version.

Thank you Sir
Is This A Good Question/Topic? 0
  • +

Replies To: Find The Java Version using C++

#2 harshakirans  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 4
  • View blog
  • Posts: 124
  • Joined: 26-April 06

Re: Find The Java Version using C++

Posted 26 October 2007 - 02:12 AM

Dude the objective of this forum is to help people learn, so we cannot get your work done unless you show your effort to solve this problem.

This post has been edited by harshakirans: 26 October 2007 - 02:12 AM

Was This Post Helpful? 0
  • +
  • -

#3 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: Find The Java Version using C++

Posted 26 October 2007 - 07:48 AM

Well, users are crazy. They install java in all kinds of different ways etc. that would mess up most of the easy answers to this question.

"java -version" at the command prompt will give you the version.

So if the user has their java home in the path, well thats all you need.

If not, well there is no standard place for java to be installed at. And, as in the case of my computer, There may be multiple runtime environments installed. (I have three). So it is really best to ask the user where they jave JRE is... and then use "java -version"
Was This Post Helpful? 0
  • +
  • -

#4 1lacca  Icon User is offline

  • code.rascal
  • member icon

Reputation: 44
  • View blog
  • Posts: 3,822
  • Joined: 11-August 05

Re: Find The Java Version using C++

Posted 26 October 2007 - 09:46 AM

In windows there are registy keys here:
HKLM\Software\JavaSoft\Java Runtime Environment
They might be a good start, but if the user was hacking around and uninstalled some of them by simply deleting by hand, they might not work anymore. Also, it looks-like it's been only going on since 1.5.x, or I might have somehow got rid of my 1.4.2. - which works fine anyway.
So this might be a pointer to places to check.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1