{"id":68,"date":"2006-03-06T15:55:13","date_gmt":"2006-03-06T20:55:13","guid":{"rendered":"http:\/\/www.juixe.com\/techknow\/?p=68"},"modified":"2006-03-06T15:55:13","modified_gmt":"2006-03-06T20:55:13","slug":"webstart-headstart","status":"publish","type":"post","link":"http:\/\/juixe.com\/techknow\/index.php\/2006\/03\/06\/webstart-headstart\/","title":{"rendered":"WebStart HeadStart"},"content":{"rendered":"<p>Java&#8217;s WebStart was to solve some deployment problems, but recently I&#8217;ve had two deployment issues with it.  The first issue is as follows; using Internet Explorer I would get the following error when trying to open a WebStart JNLP file:<\/p>\n<pre>\nAn error occurred while launching\/running the application.\nCategory: Invalid Argument Error\nCould not load file\/URL specified:\nC:\\...\\Content.IE5\\...\\webstart[1].jnlp\n<\/pre>\n<p>The Wrapped Exception states that this is basically a FileNotFoundException on the client side.  What happened was that IE didn&#8217;t cache the JNLP file on the client side and WebStart can&#8217;t find the JNLP file when it tries to launch the application.  I found some advice on forums after googling for &#8216;WebStart Content.IE5&#8217; and other search terms.  Some forums stated that I needed to clear IE&#8217;s cache.  Others suggested that I had to move the IE cache to a different directory.  What worked for me was that I had to explicitly tell IE to cache the JNLP file using some JSP code.<\/p>\n<pre>\n\/\/ Set IE HTTP\/1.1 no-cache headers.\nresponse.setHeader(&quot;Cache-Control&quot;,\n   &quot;post-check=900, pre-check=3600&quot;);\n\/\/ Set standard HTTP\/1.0 no-cache header.\nresponse.setHeader(&quot;Pragma&quot;, &quot;cache&quot;);\n<\/pre>\n<p>The other problem with WebStart that I have had in the past is in the way you auto-detect if WebStart is installed.  To auto-detect Sun&#8217;s documentation provides you with some nasty client side JavaScript and Vbscript code.  It is nasty because it is doesn&#8217;t even works properly, a <a href=\"http:\/\/bugs.sun.com\/bugdatabase\/view_bug.do?bug_id=4894977\">bug<\/a> is filed for this.  I have two machines, both of which have Java 1.4.2_08 installed.  But for some reason only one machine can create a JavaWebStart.isInstalled.1.4.2.0 object using the Visual Basic script on IE.    This must be a Java plugin problem.  A way around this is to use IE object tag.  The following bit of code is what Sun provides you to auto-detect if your client has WebStart installed.<\/p>\n<pre>\n&lt;script type=&quot;text\/javascript&quot; language=&quot;javascript&quot;&gt;\nvar javawsInstalled = 0;\nvar javaws12Installed = 0;\nvar javaws142Installed = 0;\n\nisIE = &quot;false&quot;;\nif (navigator.mimeTypes && navigator.mimeTypes.length) {\n   x = navigator.mimeTypes['application\/x-java-jnlp-file'];\n   if (x) {\n      javawsInstalled = 1;\n      javaws12Installed = 1;\n      javaws142Installed = 1;\n   }\n}else {\n   isIE = &quot;true&quot;;\n}\n&lt;\/script&gt;\n\n&lt;script LANGUAGE=&quot;VBScript&quot;&gt;\non error resume next\nset jws = &quot;JavaWebStart.isInstalled&quot;\nset jws12 = &quot;JavaWebStart.isInstalled.2&quot;\nset jws142 = &quot;JavaWebStart.isInstalled.1.4.2.0&quot;\nIf isIE = &quot;true&quot; Then\n  If Not(IsObject(CreateObject(jws))) Then\n     javawsInstalled = 0\n  Else\n     javawsInstalled = 1\n  End If\n  If Not(IsObject(CreateObject(jws12))) Then\n     javaws12Installed = 0\n  Else\n     javaws12Installed = 1\n  End If\n  If Not(IsObject(CreateObject(jws142))) Then\n     javaws142Installed = 0\n  Else\n     javaws142Installed = 1\n  End If\nEnd If\n&lt;\/script&gt;\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Java&#8217;s WebStart was to solve some deployment problems, but recently I&#8217;ve had two deployment issues with it. The first issue is as follows; using Internet Explorer I would get the following error when trying to open a WebStart JNLP file: An error occurred while launching\/running the application. Category: Invalid Argument Error Could not load file\/URL [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","footnotes":""},"categories":[15,16,3],"tags":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p902K-16","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/posts\/68"}],"collection":[{"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/comments?post=68"}],"version-history":[{"count":0,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/posts\/68\/revisions"}],"wp:attachment":[{"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/media?parent=68"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/categories?post=68"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/tags?post=68"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}