QTP腳本設置java環境變量

發表于:2008-04-29來源:作者:點擊數: 標簽:qtpQTP腳本javaJAVA
QTP 腳本設置java環境變量 ''''''''''''''''''''''''''''''''''''''' 'This qtp scriptis used for setting the java environment variable automaticly. 'save the scirptunder the JDKfolder 'author :yks(YangKongSuo) 'if forward this script please in
QTP腳本設置java環境變量

'''''''''''''''''''''''''''''''''''''''
'This qtp script  is used for setting the java environment variable automaticly.
'save the scirpt  under the JDK  folder
'author :  yks(YangKongSuo)
'if forward this script please indicate the author
''''''''''''''''''''''''''''''''''''''''
Dim fso,wsh,env_path,classpath,TestDir
Set fso = CreateObject("Scripting.FileSystemObject")
TestDir = Environment("TestDir")
J2SDK_path = fso.GetParentFolderName(TestDir)
Set wsh = CreateObject("WScript.Shell")
If not  fso.FileExists(J2SDK_path&"\bin\java.exe") then
msgbox (J2SDK_path&"\bin\java.exe not existing")
ExitTest
else
wsh.Environment("system").Item("JAVA_HOME")=J2SDK_path
    env_path = wsh.Environment("system").Item("PATH")
If  instr(1,env_path, ";" & J2SDK_path & "\bin",1) = 0 Then
  wsh.Environment("system").Item("PATH")=env_path & ";" & J2SDK_path & "\bin"
End If
classpath = wsh.Environment("system").Item("CLASSPATH")
If instr(1,classpath, ".;"&J2SDK_path&"\lib\tools.jar",1) = 0 Then
  wsh.Environment("system").Item("CLASSPATH")=classpath & ".;"&J2SDK_path&"\lib\tools.jar"
  classpath = wsh.Environment("system").Item("CLASSPATH")
  wsh.Environment("system").Item("CLASSPATH")=classpath&";"&J2SDK_path&"\lib\dt.jar"
  classpath = wsh.Environment("system").Item("CLASSPATH")
  wsh.Environment("system").Item("CLASSPATH")=classpath&";"&J2SDK_path&"\jre\lib\rt.jar"
End If  
end if

原文轉自:http://www.anti-gravitydesign.com

国产97人人超碰caoprom_尤物国产在线一区手机播放_精品国产一区二区三_色天使久久综合给合久久97