We distribute an application by web start which can be used to process and visualize data. Some of our users need to load large amounts of data, so we need to set the max-heap-size variable to a value larger than the default of 256 MB. However, we can't simply set the max-heap-size to a very large value, because then the program will not run at all on machines with less available memory. (It will present the error "Could not reserve enough space for object heap")
So we provide multiple jnlp files which differ only in the value of max-heap-size. The customer can choose which one to use. Since all the jnlp files refer to the same set of jar files, only one set of jar files gets downloaded to the user's machine.
This works, but presents several issues:
Instead of one jnlp file, customers have to choose between five.
If we want to edit the jnlp file, we have to remember to edit all five.
If the user tries loading first one version, then another, then the web start application manager will maintain a list of all versions as if they were separate applications, which again may confuse the user. (We set the title differently in each one to make this less confusing.)
Here is a shortened version of what one of our jnlp file looks like.
Again, this works, but we think it is not an optimal solution. Does anyone have any ideas or advice on other ways we can let the user choose the amount of heap memory to allocate to our program ?
Thanks in advance. Ed [ October 10, 2005: Message edited by: Ed Ewing ]
You need to offer different dynamically created jnlp files to different users. For this your users have to be authenticated. Having the user authenticated makes it also possible to dynamically generate the jnlp file, and thus put user tailored heap sizes into the jnlp file. The starting jnlp file will be named the same, it will actually be only one, so the caching and calling of the jnlp file will not counfuse the user. I will have a start.jnlp file for the unauthenticated users (if that's really necessary) and modify the heap size for other users. If authentication is already in place then you are almost done.
Alternatively, if you cannot use authentication then offer a Web page in which there will be let's say 5 links for every 5 heap configurations. Every link points to the same start.jnlp but it also sends a parameter. It will look like this: http://your_server/start.jnlp&profile=1 [...] http://your_server/start.jnlp&profile=5 On the server you have a Filter attached to the JnlpDownloadServlet which reads the parameter profile and, for example using a FilterWrapper writes the heap paramters into the start.jnlp. This second solution is simpler and doesn't need authentication. I personally prefer the first one as it is more scalable and user friendly.
More: you would prehaps like having a Web application with a basic Web interface which allows the modification of the heap sizes associated with the profiles.
Joined: Aug 30, 2005
Originally posted by Cristian Negresco: Hello,
You need to offer different dynamically created jnlp files to different users.
Thanks for the suggestion.
I think that is probably the way to go, but it isn't quite perfect with the java 1.4 version of webstart.
Ignoring authenticaion for the moment, I made a simple jsp page called "test.jnlp" that looks something like this:
(Most of the jnlp omitted for clarity)
For those who don't read jsp files, what this does is generate a separate jnlp file depending on whether you access it as "test.jsp?size=1" or "test.jsp?size=2". In each case, the href parameter is set to refer back to the same dynamically-generated jnlp file.
This works perfectly on the version of webstart that comes with JDK1.5 (tested on Windows).
But on JDK1.4 (tested on Linux), the web-start application manager still considers "test.jsp?size=1" and "test.jsp?size=2" to be two separate applications, so for JDK1.4 there is no improvement using dynamic generation of jnlp relative to our old version of using separate jnlp files like "test_1.jnlp" and 'test_2.jnlp".
We could omit the href="..." portion of the dynamic jnlp file. (It is optional.) But then our application doesn't show-up in the javaws application manager at all, the user can't create a shortcut to the application, and no dynamic-updating is done, and we don't want that to lose those features.
So, if I knew that all the customers were using JDK1.5, then I would update to this system. But until then, I think I will stick to the ugly old method with 5 separate jnlp files.
Unless, of course, anyone has any better suggestions....
We are having the same exact problem as yours.
I am trying to follow your simple solution since our users use JDK1.5 or greater.
1) Is your test.jsp is a "jsp" page or "jnlp" page.
because your said i have created a jsp called "test.jnlp" and your refer back to the same test.jsp page.
I have tried this and it is not working for me.
1) created a "test.jnlp" file and put the contents <% .... %> finding the max heapsize for each your according how they called the script etc,
but if call with test.jnlp&size=1 it says "link broken" or if I just test.jnlp it says error, the tag "<jsp>" is not defined in this file.
Can you please help me to understand what is happening in your script.