Commande VBS pour connaitre la Version de JVM installée
Commande VBS pour connaitre la Version de JVM installée - VB/VBA/VBS - Programmation
MarshPosté le 24-11-2005 à 11:14:21
Salut tt le monde, est-ce que quelqu'un connaît la commande en VBS qui permet de connaître le type de JVM (JAVA Virtual Machine) installée sue le PC. On a la possibilité de le savoir via l'internet explorer, dans Outils>Options Internet... , dans l'onglet "Avancé"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' detectIEJVM.vbs reads HKLM registry keys to determine ' if IE configured to use Sun JavaPlugin (Java2 JVM). ' Determines MS JVM version. ' M. Gallant 06/19/2002 ' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Option Explicit If Java2Checked() Then WScript.Echo "IE using Sun JVM: " & JavaPluginPath() ElseIF MSJVMVersion() <> "0" Then WScript.Echo "IE using MS JVM: " & MSJVMVersion() Else WScript.Echo "IE MS JVM ""msjava.dll"" not found" End If
'--- Get registry path pointer to "UserJava2IExplorer" setting Function JavaPluginPath() Dim WshShell, IEJava2Option, java2path, version Set WshShell = WScript.CreateObject("WScript.Shell" ) IEJava2Option="HKLM\SOFTWARE\Microsoft\Internet Explorer\AdvancedOptions\JAVA_SUN\SELECT\RegPath"
On Error Resume Next java2path = WshShell.RegRead(IEJava2Option) If Err.Number <> 0 Then ' if REG_PATH named-value does not exist JavaPluginPath = "0" Exit Function End If On Error GoTo 0 JavaPluginPath = java2path End Function
'--- Detect setting of "UserJava2IExplorer" named-value Function Java2Checked() Dim WshShell, jpath, java2setting jpath = JavaPluginPath() If jpath = "0" Then 'IE Java_Sun key not defined Java2Checked = False Exit Function End If Set WshShell = WScript.CreateObject("WScript.Shell" ) On Error Resume Next java2setting = WshShell.RegRead("HKLM\" & jpath & "\UseJava2IExplorer" ) If Err.Number <> 0 Then ' if UseJava2IExplorer named-value does not exist Java2Checked = False Exit Function End If On Error GoTo 0 If java2setting Then Java2Checked = True Else Java2Checked = False End If End Function
'--- Get MS JVM version via msjava.dll FileVersion Function MSJVMVersion Dim msjavadll Dim fso, WshShell Set WshShell = WScript.CreateObject("WScript.Shell" ) msjavadll = WshShell.ExpandEnvironmentStrings("%WINDIR%\system32\msjava.dll" ) Set fso = CreateObject("Scripting.FileSystemObject" ) If fso.FileExists(msjavadll) Then 'WScript.Echo fso.GetFileVersion(msjavadll) MSJVMVersion = fso.GetFileVersion(msjavadll) Else MSJVMVersion = "0" End If Set fso = nothing Set wshshell = nothing End Function
Marsh Posté le 24-11-2005 à 11:14:21
Salut tt le monde,
est-ce que quelqu'un connaît la commande en VBS qui permet de connaître le type de JVM (JAVA Virtual Machine) installée sue le PC.
On a la possibilité de le savoir via l'internet explorer, dans Outils>Options Internet... , dans l'onglet "Avancé"