<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>Remko Weijnen&#039;s Blog (Remko&#039;s Blog) &#187; jvm</title> <atom:link href="http://www.remkoweijnen.nl/blog/tag/jvm/feed/" rel="self" type="application/rss+xml" /><link>http://www.remkoweijnen.nl/blog</link> <description>About Terminal Server, Citrix, Delphi and other stuff</description> <lastBuildDate>Tue, 31 Jan 2012 15:37:53 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.2.1</generator> <item><title>Switch between Java Versions</title><link>http://www.remkoweijnen.nl/blog/2008/11/12/switch-between-java-versions/</link> <comments>http://www.remkoweijnen.nl/blog/2008/11/12/switch-between-java-versions/#comments</comments> <pubDate>Wed, 12 Nov 2008 14:37:52 +0000</pubDate> <dc:creator>Remko</dc:creator> <category><![CDATA[Java]]></category> <category><![CDATA[Uncategorized]]></category> <category><![CDATA[Business]]></category> <category><![CDATA[jre]]></category> <category><![CDATA[jvm]]></category> <category><![CDATA[Objects]]></category> <category><![CDATA[Switch]]></category> <category><![CDATA[Versions]]></category><guid isPermaLink="false">http://www.remkoweijnen.nl/blog/2008/11/12/switch-between-java-versions/</guid> <description><![CDATA[On a Citrix environment 2 different applications were required. One of the applications required java version 1.5 (and didn&#8217;t work with 1.6) and the other application needed specifically version 1.6. Because the applications are installed on a Citrix server the users do not have write permissions to HKEY_LOCAL_MACHINE so that was another complication. After a [...]]]></description> <content:encoded><![CDATA[<p>On a Citrix environment 2 different applications were required. One of the applications required java version 1.5 (and didn&#8217;t work with 1.6) and the other application needed specifically version 1.6.</p><p>Because the applications are installed on a Citrix server the users do not have write permissions to HKEY_LOCAL_MACHINE so that was another complication.</p><p>After a lot of monitoring with process monitor the general process of how a particular Java version loads in Internet Explorer became clear to me.</p><p>Java adds an addon to IE called ssv.dll, you can see this trough Tools | Manage Add-ons | Enable or Disable Add-ons:</p><p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2008/11/addons-3.png" class="thickbox no_icon" rel="gallery-135" title="AddOns"><img src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2008/11/addons-3-small.png" alt="AddOns" width="450" height="81" /></a></p><p><span id="more-135"></span></p><p>In Internet Explorer there is a setting under Tools | Internet Options | Advanced | Java (Sun). This activates Sun Java instead of the Microsoft version:</p><p><img src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2008/11/usejre-1.png" alt="UseJre" width="301" height="48" /></p><p>This setting corresponds to a registry key:</p><p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2008/11/java-sun-2.png" class="thickbox no_icon" rel="gallery-135" title="JAVA SUN"><img src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2008/11/java-sun-2-small.png" alt="JAVA SUN" width="450" height="157" /></a></p><p>This setting (when activated) sets the UseJava2Iexplorer value under the path specified in the RegPath key:</p><p><a  href="http://www.remkoweijnen.nl/blog/wp-content/uploads/2008/11/usejava2iexplorer-1.png" class="thickbox no_icon" rel="gallery-135" title="UseJava2Iexplorer"><img src="http://www.remkoweijnen.nl/blog/wp-content/uploads/2008/11/usejava2iexplorer-1-small.png" alt="UseJava2Iexplorer" width="450" height="157" /></a></p><p>So my first try was to change the RegPath value to Software\JavaSoft\Java Plug-in\1.5.0_11 but that doesn&#8217;t work. Problem is that IE has already loaded the Add-on ssv.dll from version 1.6 and we now make the registry point to 1.5. So we need to load the Add-on from version 1.5 as well.</p><p>So next question: where is this add-in loaded?</p><p>I searched in the registry for ssv.dll and found it in several places:</p><blockquote><p>[HKEY_CLASSES_ROOT\CLSID\{5852F5ED-8BF4-11D4-A245-0080C6F74284}\InprocServer32]<br /> @=&#8221;C:\\Program Files\\Java\\jre1.5.0_11\\bin\\JavaWebStart.dll&#8221;<br /> &#8220;ThreadingModel&#8221;=&#8221;Apartment&#8221;</p><p>[HKEY_CLASSES_ROOT\CLSID\{761497BB-D6F0-462C-B6EB-D4DAF1D92D43}\InprocServer32]<br /> @=&#8221;C:\\Program Files\\Java\\jre1.5.0_11\\bin\\ssv.dll&#8221;<br /> &#8220;ThreadingModel&#8221;= &#8220;Apartment&#8221;</p></blockquote><p>It&#8217;s interesting to know that HKEY_CLASSES_ROOT is actually a merged view of HKEY_CURRENT_USER\Software\Classes and HKEY_LOCAL_MACHINE\Software\Classes. In this case the actual values were in the HKLM branch. So I began experimenting by adding the same keys in HKCU and modifying it&#8217;s values.</p><p>After some experimenting I came up with 2 reg files that can be imported that contain only HKEY_CURRENT_USER keys. Maybe these reg files can be tweaked further but I verified the correct working by Java version check on <a  href="http://www.javatester.org/version.html">http://www.javatester.org/version.html</a>.</p><p>So simply importing a reg file can switch between Java versions! In the production environment I will make a particular version default based upon Group membership and/or the application that is started. The actual change will be done by script and maybe the user will be offered a nice &#8220;switch java version&#8221; tool. But the principle is ofcourse to make the proper registry entries under HKCU.</p><p>You can download the registry files below, please note that I used Java versions 1.5.011 and 1.6.07. So the reg files are based on those versions!</p> <a  class="downloadlink" href="http://www.remkoweijnen.nl/blog/download/JavaSwitch.zip" title="Version1.0 downloaded 1045 times">Java Version Switch Registry Files (1045)</a><p>PS Sun offers older versions download on a special <a  title="Archive: Java[tm] Technology Products Download" href="http://java.sun.com/products/archive/" target="_blank">page</a>.</p> ]]></content:encoded> <wfw:commentRss>http://www.remkoweijnen.nl/blog/2008/11/12/switch-between-java-versions/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
