If you have ever installed Citrix Presentation Server/XenApp or one of the management consoles then you have probably dealt with Java versions.
Citrix is very picky about the Java version so it’s usually best to initially install the Jre version that is delivered with the product.
In my case however I needed to install the CMC for Xenapp 5 on Windows 2003, it requires JRE 5.0 Update 9 but this version was undesirable.
So I tried to install the CMC with the current JRE version (1.6.0_22 at this time) but it makes the Installer exit immediately:
We can bypass this check by creating a Transform and modifying a few Public Properties (I tried to set the values for these properties by commandline but this is not accepted).
I used the Orca tool from the Windows SDK, here are the steps required:
- Start Orca and open the CMC.msi
- From the Menu Bar select Transfrom | New Transform
- Select the Property table and sort the Properties by their name:
Now modify the following properties:
Accept from No -> Yes
CTX_USE_EXISTING_JRE from No -> Yes
JRERequiredVersion.E345A43A_38FF_4EEE_AF87_24C4B9518A97 from 1.5.0_09 -> 1.6
- Choose Transfrom | Generate Transfrom from the Menu Bar
- Save the transfrom
- Launch MsiExec with the TRANSFORMS option, eg MsiExec /i CMC.msi TRANSFORMS=Java16.mst
Now you can install the CMC with any Java 1.6xxx version.
But we’re not finished yet!
When I attempted to start the console after install I got this error:
This error is caused by the console loader, a small executable called CtxLoad.exe which resides in %ProgramFiles%\Citrix\Administration (or %ProgramFiles(x86)% on x64 systems).
But why does it fail? To find out I opened CtxLoad.exe in Ida Pro and searched for strings containing Java:
That looks like it’s a hardcoded path! In Ida you can use Ctrl-X to check for references and the Disassembly shows the registry check:
In C that would like like:
lResult = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\JavaSoft\\Java Runtime Environment\\1.5", 0, KEY_READ, &hKey);
if ( lResult = ERROR_SUCCESS )
So now we can fix it, there are several possible solutions:
- Create fake 1.5 Java registry keys pointing to the same values as 1.6.
- Create a REG_LINK (it’s possible to create shortcuts in the registry) for Java 1.5 pointing to 1.6
- Patch CtxLoad.exe
I choose 3 since I think 1 is a bad idea and 3 is done a lot faster than 2.
For you convenience you can download all files: CtxLoad Patch (1018)
The download includes the original and the patched CtxLoad, the patcher with dUP2 source and the mst file.