JNLP file caching

I have a JNLP file that does not include <offline-allowed/>. How long does JWS cache such a JNLP file?
The reason I ask is that I had a bug (my fault) with which the JNLP file didn't correctly reference itself---it referenced a non-existent JNLP file. JWS gave me an error, but the JNLP file it listed in the error report was a different JNLP file altogether---one that I was working on earlier, and that didn't even exist anymore!
How can I make sure the JNLP file is never cached? Do I have to send all sorts of headers to turn of the cache, such as Pragma: no-cache and the like?
Garret

Ooh, this is really bad.
JWS apparently caches the JNLP uses it for any remote JNLP accessed at the same remote URL ignoring any URL query parameters!.
I have a JNLP that is dynamically generated at example.com/jnlp?param=value
Once I've downloaded the application, JWS tucks it away and uses it forever and ever!
If later I try to access a different JNLP at example.com/jnlp?param=anothervalue, JWS completely ignores the contents of the actual JNLP it gets from the web and uses its locally cached version, which of course has a different href than the one that was generated from example.com/jnlp?param=anothervalue. JWS then tries to go get the JNLP from the wrong href, either retrieving a different JNLP or giving an error.
What can I put in my JNLP to tell JWS not to cache it? Why doesn't JWS look at the whole URL, or look at times and dates, or something rather than just blindly caching my JNLP?
Garret

Similar Messages

  • Does the Browser cach the jnlp-file?

    I have a problem, I think with the browser's caching. As I modify the *.jnlp-File, the old version is loaded, not the new one!
    Or is the old version cached by the webStart-Caching-Mechanism?
    To update the jnlp-file, sometimes it is helpful to clear the Clients webStart cache.
    Is that correct?
    regards,
    ulli

    The browser does in fact cache the jnlp and it can be a real problem. If there is no expiration on the JNLP then the browser may load it from cache instead of going to your web server on the next access. This means you may have modified your JNLP on the server for a new release, but users can start your application WITHOUT GETTING THE LATEST JNLP!
    You can solve this problem by serving the JNLP file from your own servlet (or other HTTP serving technique) and setting the expire header. Setting it to 0 does the right thing.
    Do NOT however, set "Pragma", "no-cache". no-cache stops the browser from writing the JNLP to the file system...this in turn causes a problem when Web Start tries to find the jnlp file after the browser starts Web Start....the jnlp file is not there.
    Note that the JnlpDowloadServlet provided by Sun in the Web Start developers kit does NOT expire the JNLP file...you must fix this code yourself if you want it to work correcly. Sun was supposed to make this source code available but I can't find it anywhere. We used a de-compiler to de-compile the code, fix it and re-jar it.

  • Can application know the location of its most recent cached *jnlp* file?

    Can an application know if it was launched by clicking on the hyperlink in a web page, or whether it was launched from the shortcut on the desktop?
    Alternatively, Can the application know the location of its most recent cached jnlp file on the desktop?
    To take a specific example, let's say I have a word processor, My Word that is deployed using Web Start. It can view documents on the web and must also work offline to view local documents.
    When a user clicks the hyperlink to the doc, say,
    myParty Open the myParty document
    then myParty.jnlp launches My Word, opening the myParty.txt file.
    Since there is no way to pass arguments dynamically, one must have a jnlp file for each doc.
    So myParty.jnlp has the url of the doc hardcoded in it.
    <application-desc main-class="MyWord">
    <argument>http://www.MySite.com/myParty.doc</argument>
    </application-desc>
    The problem is that apparently Web Start uses the most recent jnlp each time it is launched.
    So that if the file has moved, or if one is offline, then the application hangs because it is trying to open the same document, regardless of whether MyWord was launched by clicking on the hyperlink in a web page - in which case this would be appropriate - or whether it was launched from the shortcut on the desktop - inappropriate here.
    As a workaround, I was wondering - where is the jnlp file stored on the local desktop?
    If the application could find the most recent jnlp, then it could rewrite it (after it was opened the first time) with an identical jnlp that has no application-desc arguments.
    Then when the user runs from the shortcut on the desktop, it will launch without a document to open.
    Any help appreciated.
    thanks,
    Anil Philip
    Are you planning to kill yourself? Stop! listen to this song
    broadband version: http://www.youtube.com/watch?v=pLHHB4YZucI
    dial-up version: http://www.youtube.com/watch?v=xL5WyBenUpM

    1) To make it more complicated, it seems that the browser also does the caching.
    2) I could not find the jnlp as a file on the desktop, so I suspect that is stored in some database. Is there any way the application can write to it or any api to simply allow the application to change the arguments?
    3) It is not an option to use jnlpservlet as the document can be placed anywhere and not just on a webserver under our control.
    Edited by: anilp1 on Mar 20, 2009 9:40 PM

  • Could not load file/URL (file not found) error for JNLP file

    I am completely baffled in trying to figure out why I am getting the following error for some JNLP files but not others:
    Error: could not load file/URL specified: C:\Users\tom\AppData\Local\Temp\javaws2
    java.io.FileNotFoundException: C:\Users\tom\AppData\Local\Temp\javaws2 (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
    at com.sun.javaws.Main.launchApp(Unknown Source)
    at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
    at com.sun.javaws.Main$1.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)I have Googled around this forum and elsewhere, and have seen reports that this error is IE-specific, and seems to have something to do with no-cache headers being sent, or with the client browser's cache being full or turned off (which is not my case). I saw the information in the JavaWS FAQ, which recommended turning off security constraints for the JNLP's URI. I tried that, and it didn't help. One of the very baffling things is that I have created several variations of the JNLP file, with varying combinations of jars and property resources, and some combinations always work while other combinations never work. Here's an example:
    <jnlp spec="1.0+" codebase="$$codebase">
       <information>
          <title>demo app</title>
          <description>illustrates weird bug</description>
       </information>
       <resources>
          <j2se version="1.5+"/>
          <jar href="randomFile.jar"/>
          <property name="xxx" value="xxxx"/>
          <property name="swing.metalTheme" value="steel"/>
       </resources>
    </jnlp>The above file always fails with the error shown at the top of this message. However, if I remove either of the two properties, it works fine. And I have created other variations with lots of properties, some of which work. All of these variations are in the same directory in the war file, served by the exact same servlet (a slightly modified version of the jnlp.sample.servlet.JnlpDownloadServlet provided with JDK 1.6.0_3). Assuming that a no-cache header is the problem, what on earth could be causing some JNLP files to always be served with a no-cache header, while others are never served with a no-cache header?
    On a related note, any recommended debugging techniques for seeing what headers are being transmitted? I tried adding a simple check for a "debug=true" parameter in the servlet that causes it to set the content type to "text/plain" instead of JNLP, and that allows me to see (rather than execute) the JNLP XML that's being returned, but it doesn't show me the HTTP headers that are being sent back. If any caching headers are being set, I think it must be being set by the servlet container itself, as it's nothing being set in the servlet code that I can see. So I don't see any way on the server side Java code to output or log the actual HTTP response (or is there?). Any tips in that regard much appreciated.
    Edited by: TomC125468 on Aug 19, 2009 1:35 PM

    Hi Luca-Sanna,
    Thanks for the response. Re browsers, yes, it fails in IE but it succeeds in Firefox. The info on the JavaWS FAQ and other places all seem to indicate that it's an IE issue concerning handling of the cache-control headers.
    I should check in my webserver forum (Sun WebServer 7) to see about logging options. Sniffing on the client side is not possible, as my app is required to use HTTPS exclusively, and unfortunately that also precludes a telnet GET request.

  • Deploying a JNLP file to corporate users?

    When it comes to Java, I'm pretty clueless. I was a VB programmer years ago, and now I deal mostly with Python apps.
    I have a corporate client with ~80 workstations. One of their primary business applications is deployed by a jnlp file. Their tech support said to go to http://theirapplication.com/app.jnlp and the program will install.
    I have tried a few test methods of getting this pushed out to every user.
    The first was to deploy a shortcut to their desktop called "TheirApp" which pointed to that jnlp file.
    In practice, that launches IE, downloads the JNLP file, checks if the app is installed, installs it if it isn't, and then runs the app. Plus, the app drops a new shortcut onto the desktop for directly launching the program. The shortcut points to javaws and then a long path to some per-user cache folder. So now users are confused by two shortcuts.
    When the app initially starts, it asks for a bunch of settings--like really long account numbers. All this info appears to be per-user. So when users sit down at a different workstation (which happens frequently in their environment), clueless users are asked to install the app and put in all those initial settings.
    The second method was a failure--I tried deploying a shortcut to start javaws pointing to that cache folder. I didn't really expect it to work. On new machines it failed because that app hadn't been installed into that cache folder yet. On existing installs, it would work for users that had previously installed it, but new users wouldn't work because the cache folder is stored under a different users settings folder.
    So I guess my questions for the Java community would be these:
    Is there a way to deploy a java webstart app per-machine?
    Is there a way to share the same cache folder between all the users on the network so they see all the same settings?
    Does anyone have similar experiences and suggestions on how to better deploy jnlp applications?
    Thanks for reading.
    -Aaron

    To pre-install you can use the -import option.
    Something like
    javaws -import -silent http://whateverTheServer.ext/whateverTheJnlp.jnlpYou could even copy all files to a local server and override codebase with -codebase option.
    You could try (but I've heard people complain about it) to use the -system option so that all machine users run same instance (app is installed once per machine, not once per user and machine).
    About properties, the most common way to store data is to put them in the user.home dir, have a look there, maybe you can spot out a file (or a directory) and just tell user to copy their setting on a USB drive and paste them (into user.home) on any other machine they're gonna use.
    Bye.

  • Always prompted to save JNLP file

    Hello! We have a simple servlet that basically just queries a few things off of the HttpServletRequest and spits back a dynamically generated JNLP file. For some reason, when we were running with Tomcat 4.0.6 this worked fine, but with the upgrade to Tomcat 4.1.29 it does not. IE always prompts to open or save the file - it never just launches JWS automatically anymore.
    Any suggestions on what we can fix? I'll put the interesting parts of the servlet below.
    Thanks in advance!
    -Angelina
    Servlet:
    public class JNLPServlet extends HttpServlet{
        public void doGet(HttpServletRequest request, HttpServletResponse response)
           throws IOException, ServletException {
            try {          
                response.setHeader("Cache-Control", "public");
                response.setContentType("application/x-java-jnlp-file");
                String sessionId = getSessionId(request);
                ServletOutputStream out = response.getOutputStream();
                java.net.InetAddress[] hostNetAddrs =
                              java.net.InetAddress.getAllByName(request.getServerName());
                String hostIpAddr = hostNetAddrs[0].getHostAddress();
                out.println(generateJNLP(sessionId, request.getServerName(),
                                         hostIpAddr, request.getRemoteUser()));
                out.flush();          
            catch (IOException ex) {
                response.sendError(javax.servlet.http.HttpServletResponse.
                                   SC_SERVICE_UNAVAILABLE, ex.getMessage());
            catch (Exception ex) {
                response.sendError(javax.servlet.http.HttpServletResponse.
                                   SC_INTERNAL_SERVER_ERROR, ex.getMessage());
        protected String generateJNLP(String sessionId, String host, String ip, String userName){
            StringBuffer buf = new StringBuffer();
            buf.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
            buf.append("<jnlp spec=\"1.0+\" codebase=\"http://" + ip + ":80/cmv2/\">\n");
            buf.append("<information>\n");
            buf.append("<title>App V2.3 on " + host + "</title>\n");
            buf.append("<vendor>EMC Corporation</vendor>\n");
            buf.append("<homepage href=\"http://www.emc.com\" />\n");
            buf.append("<description>Program for monitoring performance.");
            buf.append("</description>\n");
            buf.append("<icon href=\"cm.gif\" width=\"32\" height=\"32\" depth=\"3\" size=\"1k\" />\n");
            buf.append("<offline-allowed />\n");
            buf.append("</information>\n");
            buf.append("<security>\n");
            buf.append("<all-permissions />\n");
            buf.append("</security>\n");
            buf.append("<resources>\n");
            buf.append("<j2se version=\"1.4+\" href=\"http://java.sun.com/products/autodl/j2se\"");
            buf.append("initial-heap-size=\"64m\" max-heap-size=\"194m\" />\n");
            buf.append("<property name=\"host_name\" value=\"" + host + "\"/>\n");
            buf.append("<property name=\"host_port\" value=\"80\"/>\n");
            buf.append("<property name=\"host_IP\" value=\"" + ip + "\"/>\n");
            buf.append("<property name=\"secure_host_port\" value=\"443\"/>\n");
            buf.append("<property name=\"session_id\" value=\"" + sessionId + "\"/>\n");
            buf.append("<property name=\"user_name\" value=\"" + userName + "\"/>\n");
            buf.append("<jar href=\"cmv2.jar\" />\n");
            buf.append("<jar href=\"ohj-jewt-4_1_9.jar\" />\n");
            buf.append("<jar href=\"help-4_1_9.jar\" />\n");
            buf.append("<jar href=\"oracle_ice-5_06_3.jar\" />\n");
            buf.append("<jar href=\"emcshared.jar\" />\n");
            buf.append("<jar href=\"xerces.jar\" />\n");
            buf.append("</resources>\n");
            buf.append("<application-desc main-class=\"com.emc.wclient.Login\">\n");
            buf.append("</application-desc>\n");
            buf.append("</jnlp>\n");
            return buf.toString();
    }

    The underlying problem is a combination of tomcat 4/5 being more standard and IE being less standard. Tomcat changed to automatically add ";charset=ISO-8859-1" to the end of the Content-Type header while IE appears to not correctly process the Content-Type header.
    IE maintains a list of known MIME types in the registry under [HKCR]\MIME\Database\Content Type. There you will find an entry for 'application/x-java-jnlp-file' which indicates that this MIME type is treated as a file with the suffix '.jnlp'.
    Unfortunately, IE treats EVERYTHING after the Content-Type: as the MIME type NOT just the stuff between the ':' and the ';'. Thus instead of looking for a registry entry for 'application/x-java-jnlp-file' it winds up looking for 'application/x-java-jnlp-file;charset=ISO-8859-1" and doesn't find it.
    If you duplicate the 'application/x-java-jnlp-file' entry with the name 'application/x-java-jnlp-file;charset=ISO-8859-1' everything works. Alternatively, if you make sure the 'file name' portion of the URL which requests the jnlp spec has the suffix '.jnlp' IE will work correctly. If you are generating the jnlp spec via your own servlet you can control the behavior of Tomcat by calling 'setCharacterEncoding(null)' on the response object (note this is not a method of the HttpServletResponse interface, you have to cast to the underlying concrete type).
    So, I think IE's use of the 'suffix' is non-standard and IE's handling of the Content-Type header field is just broken. If you can make the requesting URL have the .jnlp suffix you are ok; otherwise, there does not appear to be a good solution.

  • How to embed jnlp file into html page using object tag

    hi everyone,
    i have written one jnlp file like this.
    <?xml version="1.0" encoding="utf-8" ?>
    <!-- JNLP file for Demo applicaion -->
    <jnlp spec="1.0+" codebase="http://localhost:9080/base/" href="SampleExample.jnlp">
         <information>
              <title>Demo Application</title>
              <vendor> </vendor>
              <description>Sample Demo Application</description>
              <offline-allowed/>
         </information>
         <security/>
         <resources>
              <j2se version="1.3+" />
              <jar href="common.jar" main="true" download="eager" />
              <jar href="classes12.jar" download="eager" />
              <jar href="toplink.jar" download="eager"/>
              <package name="com.applet.*" part="applet" recursive="true"/>
         </resources>
         <applet-desc name="grid" main-class="com.applet.PriceGrid" width="1000" height="300"/>
    </jnlp>
    i am trying embed that jnlp file using object tag like
    <OBJECT
    classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH="1000" HEIGHT="300" NAME="grid">     
    <PARAM NAME="jnlp" VALUE="http://localhost:9080/base/SampleExample.jnlp">
    </OBJECT>
    but i am not able to load the applet using Web Start.
    Can anyone please help me. This is very Urgent for me.
    Thanks & Regards,
    Shiva.

    thanks.
    i am giving my problem clearly. i have one applet. Previously i am loading the applet in my html page using object tag like this...
    <OBJECT
    classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH="1000" HEIGHT="300" NAME="grid">
    <PARAM NAME="CODE" VALUE="com.adp.base.applet.PriceGrid.class" >
         <PARAM NAME="ARCHIVE" VALUE="common.jar,classes12.jar,toplink.jar" >
         <PARAM NAME="NAME" VALUE="grid" >
    <PARAM NAME="type" VALUE="application/x-java-applet">
    <PARAM NAME= "cache_option" VALUE ="no">
    </OBJECT>
    now what i need to do is
    i need load the applet only first time using web start and when ever the applet code changes in the server i need to reload the applet.
    for that i kept all the applet resources in .jnlp file.i want to cache all the resources which are in .jnlp file and applet must be displayed within a web page within a browser.
    Webstart always open a new application windows.
    I need to run an Applet embedded within a web page within a browser.
    Is there a way to still use Webstart?

  • How to load .jar files when not specified in the .jnlp file

    Hello,
    We are deploying an application with JWS but due to the nature of this app, we need to download additional jar file only when the user has been authenticated. The jar file(s) we need to download can hardly be predicted (in term of name) and thus cannot be all listed as lazzy resource in the .jnlp file.
    However, we would like to take advantage of the various JWS features relateed to .jar download and cache and would prefer not to reinvent the wheel by implementing our on stuff (i.e. URLClassLoader with caching etc.).
    Any idea, suggestion?
    Thanks in advance.
    Fred.

    How about writing a second jnlp file with the optional jar listed in it and running it only if your user is authenticated?

  • JNLP & System Cache

    Hello,
    I have installed a JNLP app into the system cache and it fails to run under the administrator account in Windows XP SP2. But when I install it to the administrator's user cache the JNLP app works fine. Also, if I install the JNLP app to a normal user's cache, an exception appears and it is the same as when trying to run the JNLP app in the system cache when logged in as an administrator. The exception is java.lang.NullPointerException. I should mention that I do not have the source code to the JNLP app, it is a freely available physics simulation, Phet, http://www.colorado.edu/physics/phet/web-pages/index.html. I am trying to distribute it to a school's network, so our physics teacher can utilize it in his classes.
    So does anybody have any ideas why a JNLP app would not work from the system cache, even when logged in as an administrator?
    Thanks

    Hi, I'm having a similar kind of problem. I got the following error when I try to install the application into the system cache. I'm using command line option -system
    General tab
    An error occurred while launching/running the application.
    Title: <title>
    Vendor: <vedor>
    Category: Launch File Error
    Installation failed
    Exception tab
    JNLPException[category: Launch File Error : Exception: null : LaunchDesc:
    <jnlp spec="1.0+" codebase="http://myserver:9080/installer_web/launch/" href="http://myserver:9080/installer_web/launch/installer-ext.jnlp">
      <information>
        <title>Installer</title>
        <vendor>vendor</vendor>
        <homepage href=""/>
        <icon href="http://myserver:9080/installer_web/launch/images/icon.gif" kind="default"/>
        <offline-allowed/>
      </information>
      <security>
        <all-permissions/>
      </security>
      <resources>
        <j2se version="1.5+"/>
        <jar href="http://mysserver:9080/installer_web/launch/resources/app/installer.jar" download="eager" main="false"/>
      </resources>
      <installer-desc main-class="com.fs.launch.core.Welcome"/>
    </jnlp> ]
         at com.sun.javaws.Launcher.executeInstallers(Unknown Source)
         at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
         at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
         at com.sun.javaws.Launcher.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    But I could run the same application using user's cache. (without -system option)
    I configured the system cache using deployment.config and deployment.properties files as follows.
    deployment.config
    deployment.system.config=file:///C:/WINDOWS/Sun/Java/Deployment/deployment.properties
    deployment.system.config.mandatory=true
    deployment.properties
    deployment.system.cachedir=C\:\\WINDOWS\\Sun\\Java\\Deployment
    deployment.javaws.shortcut=ALWAYS
    JNLP file
    <?xml version="1.0" encoding="utf-8"?>
         <jnlp spec="1.0+" codebase="http://myserver9080/installer_web/launch/" href="$$name">
         <information>
         <title>installer</title>
         <vendor>vendor</vendor>
         <homepage href=""/>
         <description>Version 1.0</description>
         <description kind="short">installer</description>
         <icon href="images/icon.gif"/>
                   <icon kind="splash" href="images/splash.jpg"/>
                   <shortcut online="true">
                        <desktop/>
                        <menu submenu="FSOnline"/>
                   </shortcut>
         <offline-allowed/>
         </information>
         <security>
         <all-permissions/>
         </security>
         <resources os="Windows" arch="x86">
         <j2se version="1.5+" maximum-heap-size="250m"/>
         <jar href="resources/app/rmiserver.jar"/>
         <jar href="resources/app/common.jar"/>     
         <jar href="resources/app/bsf.jar"/>     
         <jar href="resources/app/xalan.jar"/>
              <jar href="resources/app/js.jar"/>           
         <nativelib href="resources/app/nativelib.jar"/>
         <property name="java.rmi.server.useCodebaseOnly" value="true" />     
         <extension name="Installer" href="installer-ext.jnlp"/>
         </resources>
         <application-desc main-class="com.fs.learner.core.rmi.FsdsRmiImpl">
              <argument>Main.htm</argument>          
              </application-desc>
         </jnlp>
    extention Installer JNLP
    <?xml version="1.0" encoding="utf-8"?>
    <jnlp spec="1.0+" codebase="http://myserver:9080/installer_web/launch/" href="$$name">
         <information>
         <title>Installer</title>
         <vendor>vendor</vendor>
    <homepage href=""/>
         <icon href="images/icon.gif"/>
         <offline-allowed/>
         </information>
         <security>
         <all-permissions/>
         </security>
         <resources os="Windows" arch="x86">
              <j2se version="1.5+"/>
              <jar href="resources/app/installer.jar"/>               
         </resources>
         <installer-desc main-class="com.fs.launch.core.Welcome">          
         <installer-desc/>          
    </jnlp>
    Please help. thx

  • Error: JAR-Ressources in JNLP-File are not signed from the same Certificate

    I have two handfull jars, all signed in batch with the same
    Certificate. When i start my App with Webstart it tells me:
    Your JAR-Ressources in JNLP-File are not signed from the same Certificate.
    "JAR-Ressourcen in JNLP-Datei sind nicht von demselben Zertifikat signiert"
    Well im shure that i signed all my jars with the same Certificate.
    What can i do to solve this problem ???

    I get the same error.
    Strangely exactly every second time it works and every second time I execute the JNLP I get the following error:
    network: Cache-Eintrag nicht gefunden [url: http://localhost:8080/fibo/lib/js_15R41.jar, Version: null]
    network: Verbindung von socket://127.0.0.1:3621 mit Proxy=DIRECT wird hergestellt
    #### Java Web Start Error:
    #### JAR-Ressourcen in JNLP-Datei sind nicht von demselben Zertifikat signiertCan this have something to do with browser caching? So that every 2nd time it tries to access the cache, fails. And than ignores the cache and works?
    Any ideas?
    Cheers,
    Rio

  • Cannot download a .jnlp file

    I'm encountering an error while downloading a .jnlp file. Everytime I try to download a .jnlp file it just shows me the source code for the jnlp.

    I had the same problem.
    Try clearing your browser cache.
    If you accessed the jnlp file in your browser before you set up the application helper (application/x-java-jnlp-file .jnlp), the browser would have cached the page and displayed it as text.
    If that doesn't fix it, make sure you have set up the web server to handle the jnlp mime type. From the Web Start developer docs:
    -snip-
    Each Web server has a specific way in which to add MIME types. For example, for the Apache Web server you must add the following line to the .mime.types configuration file:
    application/x-java-jnlp-file JNLP
    -snip-
    Then make sure you have set up your browser to launch <JRE_HOME>/javaws/javaws when it encounters the jnlp mime type. In Netscape, this is done using "Application Helpers".

  • Syntax of the JNLP file (web start) for JFX to allow desktop shortcut/icon?

    I'm having a hard time getting this to work. I'm using NetBeans v7.1.2. First of all - the resulting .jnlp file comes with the applet, as well as the application specification. The classloader is different in both of the cases from what I've seen.
    <applet-desc width="800" height="600" main-class="com.javafx.main.NoJavaFXFallback" name="jwsapp" >
    <param name="requiredFXVersion" value="2.0+"/>
    </applet>
    <jfx:javafx-desc width="800" height="600" main-class="jwsapp.Main" name="jwsapp" />
    What I did was edit out the applet part - now there is no entry in the "Type" of application in the javaws cache, it's simply blank. And it's still launched as an applet (judging by the console trace). Now we have "<jfx:javafx-desc", instead of application-desc? What does that affect? Is it safe to just fallback to 'application-desc' (then the type is properly detected)? I haven't been able to find any info on this whatsoever.
    Shortcuts.. I have Java 2.1.1 installed and this:
              <shortcut online="false">
                   <desktop/>
              </shortcut>
    does absolutely nothing for me. The shortcut never appears (even though this addition to .jnlp was designated by NetBeans). Moreover, how would I go about attaching icons to this shortcut?
    Does anyone have a working .jnlp example, that is actually able to allocate a shortcut with a predefined icon on the desktop? Thank you.
    Edited by: 919083 on Aug 12, 2012 5:06 AM
    Edited by: 919083 on Aug 12, 2012 5:07 AM

    It works fine for me.
    I'm using latest FX samples and latest 7u6 on Mac OS X.
    Tested with slightly modified version of BrickBreaker.jnlp that includes
    <shortcut online="false">
    <desktop/>
    </shortcut>
    and the shortcut is always created to me.
    Could you please try the latest 7u6 build?
    If it's still reproducible, please file a new bug at http://javafx-jira.kenai.com/
    and also could you please attach an example to reproduce the problem?

  • How to read JNLP files

    Hi , every body ,
    Cn any body give me the procedure to read a jnlp file ????
    Thanks ,
    SB

    This code may help you:
    This is in C:\Program Files\Java\jdk1.6.0_03\sample\jnlp\servlet\src\classes\jnlp\sample\servlet
    The file name JnlpFileHandler.java:
    public synchronized DownloadResponse getJnlpFileEx(JnlpResource jnlpres, DownloadRequest dreq)
         throws IOException {
    String path = jnlpres.getPath();
    URL resource = jnlpres.getResource();
    long lastModified = jnlpres.getLastModified();
    _log.addDebug("lastModified: " + lastModified + " " + new Date(lastModified));
    if (lastModified == 0) {
    _log.addWarning("servlet.log.warning.nolastmodified", path);
    // fix for 4474854: use the request URL as key to look up jnlp file
    // in hash map
    String reqUrl = HttpUtils.getRequestURL(dreq.getHttpRequest()).toString();
    // SQE: To support query string, we changed the hash key from Request URL to (Request URL + query string)
    if (dreq.getQuery() != null)
    reqUrl += dreq.getQuery();
    // Check if entry already exist in HashMap
    JnlpFileEntry jnlpFile = (JnlpFileEntry)_jnlpFiles.get(reqUrl);
    if (jnlpFile != null && jnlpFile.getLastModified() == lastModified) {
    // Entry found in cache, so return it
    return jnlpFile.getResponse();
    // Read information from WAR file
    long timeStamp = lastModified;
    String mimeType = _servletContext.getMimeType(path);
    if (mimeType == null) mimeType = JNLP_MIME_TYPE;
    StringBuffer jnlpFileTemplate = new StringBuffer();
    URLConnection conn = resource.openConnection();
    BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
    String line = br.readLine();
    if (line != null && line.startsWith("TS:")) {
    timeStamp = parseTimeStamp(line.substring(3));
    _log.addDebug("Timestamp: " + timeStamp + " " + new Date(timeStamp));
    if (timeStamp == 0) {
    _log.addWarning("servlet.log.warning.notimestamp", path);
    timeStamp = lastModified;
    line = br.readLine();
    while(line != null) {
    jnlpFileTemplate.append(line);
    line = br.readLine();
    String jnlpFileContent = specializeJnlpTemplate(dreq.getHttpRequest(), path, jnlpFileTemplate.toString());
    jnlpFileContent is the string which has all the content of the JNLP.
    //Anjali

  • Launching a JNLP file from IE works inconsistently

    Am trying to launch jnlp file from IE. The jnlp file is created via a JSP page by setting the appropriate content type. Problem is it works inconsistently. It gives an error when launching with details as mentioned below:
    If i keep trying it works finally .... why is this inconsistent behaviour!. ... please help.
    Thanks in advance.
    ====================================================
    Exception:
    CouldNotLoadArgumentException[ Could not load file/URL specified: C:\Documents and Settings\roopak.gupta\Local Settings\Temporary Internet Files\Content.IE5\4PMNG163\launchAdmin[1].jnlp]
    at com.sun.javaws.Main.main(Unknown Source)
    Wrapped Exception
    java.io.FileNotFoundException: C:\Documents and Settings\roopak.gupta\Local Settings\Temporary Internet Files\Content.IE5\4PMNG163\launchAdmin[1].jnlp (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
    at com.sun.javaws.Main.main(Unknown Source)

    Am trying to launch jnlp file from IE. The jnlp file
    is created via a JSP page by setting the appropriate
    content type. Problem is it works inconsistently. It
    gives an error when launching with details as
    mentioned below:
    If i keep trying it works finally .... why is this
    inconsistent behaviour!. ... please help.
    Thanks in advance.
    ====================================================
    Exception:
    CouldNotLoadArgumentException[ Could not load
    file/URL specified: C:\Documents and
    Settings\roopak.gupta\Local Settings\Temporary
    Internet
    Files\Content.IE5\4PMNG163\launchAdmin[1].jnlp]
    at com.sun.javaws.Main.main(Unknown
    main(Unknown Source)
    Wrapped Exception
    java.io.FileNotFoundException: C:\Documents and
    Settings\roopak.gupta\Local Settings\Temporary
    Internet
    Files\Content.IE5\4PMNG163\launchAdmin[1].jnlp (The
    system cannot find the file specified)
    at java.io.FileInputStream.open(Native
    .open(Native Method)
    at java.io.FileInputStream.<init>(Unknown
    nit>(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown
    nit>(Unknown Source)
    I have seen this happen for two reasons.
    One reason is that a vary header is sent by the Web server. This can happen for a number of reasons. Lets say you are dynimically generating your JNLP file with PHP, and you call session_start() in the jnlp this will send some headers which cause IE not to properly cache the JNLP file. You probably want to send a send a few other headers in the jsp which generates your jnlp.
    However since this behavior is happening some times and some times not. My guess is that your IE cache is close to full or need so be increased in size.
    See
    http://forum.java.sun.com/thread.jspa?forumID=38&messageID=181208&threa dID=71283
    and http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/faq.html#220
    session tracking sends no cache directive to i.e. which hoses it
    Let me know if this solved your problem,
    R
    S

  • Fail to update the jnlp file

    The application allowed user to run offline. So ,I use <offline-allowed/> in the JNLP file.
    It works well in JDK5.0:
    1.the application can run if the network is dropped.
    2.the jnlp file will be updated if the server update the JNLP.
    But in when I change JDK to version 1.4.2, something unreasonable happened:
    Even I update the server's JNLP, the client still use the old JNLP and not update it.
    In the JWS1.4.2 Developer Guide, it says:"If offline-allowed is specified, Java Web Start will also check to see if an update is available. However, if the application is already downloaded the check will timeout after a few seconds, in which case the cached application will be launched instead."
    What is the "a few seconds" mean?Is there any different between JDK1.4 and 1.5?
    The connection between client and server is not very good. I do think it may cause the problem above. But in the same connection condition, JDK1.5 works..
    So, is there any thing I can do to resolve this problem?

    <jse version="1.5+" />(is one possibility)

Maybe you are looking for