| || |
Example: Temporary Environment Variables for Java
In our organisation we had an issue with the Java Plug In. The system variables that it registered were preventing one of our applications from launching at start up.
A work around we engineered to solve this was to create a vbscript that would turn on the java environment variables when we needed it for QTP, but otherwise would be off by default.
The steps to this work around are as follows:
1) Remove the system environment variables QTP installed from your computer
2) Copy the following code into a .vbs file:
<font class="small">Code:</font><hr /><pre> Dim WshSysEnv, WshShell, colUsrEnvVars
Set WshShell = WScript.CreateObject("WScript.Shell")
Set colUsrEnvVars = WshShell.Environment("VOLATILE")
colUsrEnvVars("_JAVA_OPTIONS") = "-Xbootclasspath/a:C:\PROGRA~1\COMMON~1\MERCUR~1\FUNCTI~1\Java\clas ses;C:\PROGRA~1\COMMON~1\MERCUR~1\FUNCTI~1\Java\cl asses\jasmine.jar"
colUsrEnvVars("MIC_CLASSES") = "C:\PROGRA~1\COMMON~1\MERCUR~1\SHARED~1\JAVAAD~1\c lasses"
colUsrEnvVars("classpath") = "C:\Program Files\Common Files\Mercury Interactive\SharedFiles\JavaAddin\classes;C:\Progr am Files\Common Files\Mercury Interactive\SharedFiles\JavaAddin\classes\mic.jar; "
colUsrEnvVars("_classload_hook") = "jvmhook" </pre><hr />
When you need to run QTP with the java add in, run the .vbs file first and it will register the variables on your system. Then load QTP and your java app being tested and continue as normal. These variables will last until you log off.