Some occasions can arise when this may be needed, such as when running with agent machines which are a mixture of 32 and 64 bit Operating Systems, where the 'Program Files' folder may differ. i.e.
32 bit Operating system - 'C:\Program Files\...'
64 bit Operating System - 'C:\Program Files (x86)\...'
When the path has been set incorrectly, you will get a message such as the following:
One approach to do this would be to define a windows share / UNC path to the JDK home folder, then use the 'JavaSetOption' function to set the path. See the example below explaining this:
Create a windows share on all machines to the Java folder. e.g. 'C:\Program Files (x86)\Java\jdk1.7.0'
This share is called "jdk1.7.0" (this must be the same on all agents)
Now use a UNC path to reference this JDK share as shown in the example code below (note - on the controller, GetAgent returns "localhost"):
transaction TInit
var
hPerf : number;
sAgent : string;
begin
sAgent := GetAgent();
if sAgent = "localhost" then
JavaSetOption(JAVA_VERSION, "170");
JavaSetOption(JAVA_HOME, "\\\\My_Controller_Path\\jdk1.7.0");
JavaSetOption(JAVA_DISABLE_COMPILER, YES);
JavaCreateJavaVM();
else
JavaSetOption(JAVA_VERSION, "170");
JavaSetOption(JAVA_HOME, "\\\\"+sAgent+"\\jdk1.7.0");
JavaSetOption(JAVA_DISABLE_COMPILER, YES);
JavaCreateJavaVM();
end;
....
The following is an example of outputting, from the java process, the version used by the agent:
public void doGetVersion() throws SilkPerformerException{
if (silkPerformer != null);
String version = System.getProperty("java.version");
silkPerformer.Print(silkPerformer.GetAgent()+ " using version: " + version);
silkPerformer.Writeln(silkPerformer.GetAgent()+ " using version: " + version);
}
Please note that it must be a 32 bit version of Java installed on all agent machines in order to work with Silk Performer.
2645768