c# - Programmatically check Java 7(jre7) or higher version is installed on my system -


i want check whether java 7 or higher version of java installed on machine or not. using below code find this:

    /// <summary>     /// file path of installed java run time.     /// </summary>     /// <returns>full path of java run time.</returns>     private static string getjavapath()     {         registrykey javaruntime = registry.localmachine.opensubkey("software\\javasoft\\java runtime environment");         string currentverion = javaruntime.getvalue("currentversion").tostring();         string javasubversion = (javaruntime.opensubkey(currentverion)).getvalue("javahome").tostring();         string filepath = path.combine(javasubversion, @"bin\javaw.exe");         return filepath;     } 

i need javaw.exe (java version) on system. please this.

if understand well, hkey_local_machine\software\javasoft\java runtime environment give current version other jre versions can retrieved under hkey_local_machine\software\wow6432node\javasoft\java runtime environment.

note might worth looking jdks (since embed jre , no referenced under keys here above). can find them @ hkey_local_machine\software\wow6432node\javasoft\java development kit , hkey_local_machine\software\javasoft\java development kit.


Comments