JNLP file: not to create desktop shortcut - java

In our webstart JNLP file, I have removed the shortcut and desktop tag, but when installing the webstart app, it still prompts me if I want to create a desktop shortcut.
So in the information tag it looks like this:
<information>
<title>Dynamic Tree Demo</title>
<vendor>Dynamic Team</vendor>
<icon href="sometree-icon.jpg"/>
</information>
Is there any way to do this?

Your best bet is to add query params to the href e.g. if the current value is the.jnlp, make it the.jnlp?a=b. The JWS client will presume it is generated dynamically and will generally not create a desktop shortcut.
I say 'generally' since it is really up to the JWS client & how it is configured.

Related

Specifying a jQuery mobile main page

Given a jQuery Mobile app with several pages
Home.html > Profile.html > Registration.html > ...
How do i set up my app so Home is the page that loads first and is presented to the user when they launch the app on their mobile?
It depends on what are you doing.
If you are creating a basic mobile web page that this depends on your web server. If you are working with Apache web server you would change httpd.conf and replace this:
DirectoryIndex index.html
with this:
DirectoryIndex index.html main.html
Or if you don't have access to your web server you would create a .htaccess in your project directory and do same thing as above. Read more about it here.
On the other hand, if you are working with Phonegap then all you need to do is change location Phonegap looks for app initialization.
This is Android example:
super.loadUrl("file:///android_asset/www/main.html");
Read more about it here.
But you should stick to standards and rename main file to index.html
iOS is little bit different, unlike Android, you need to change some configurations thus forcing iOS to load different file then index.html.
In Classes folder open AppDelegate.m and change this:
self.viewController.startPage = #"index.html";
to this:
self.viewController.startPage = #"main.html";

Deploy JNLP applet *without* Next Gen Java Plugin

I need to deploy an applet on a .jsp page and want to take advantage of lazy loading and pack200 that you get when using JNLP. However my client does not have the Next Gen Java Plugin enabled on their machines and they do not want to enable it. This means I can not take advantage of the jnlp_href attribute introduced in java 1.6.10.
After some research I discovered you can specify an applet-desc in my jnlp but I am new to JNLP and do not know how to fully take advantage of this tag.
I have not seen any solid examples of how to use a JNLP file on a webpage without using the applet or object tags which require the jnlp_href param attribute.
Is it possible using this applet-desc tag to inject a reference to my JNLP in my .jsp page?
Currently I specify my applet using the object HTML element like this:
<object code="<myappletClass>" name="pdfapplet" codebase="<myCodeBase>" mayscript>
<param name="jnlp_href" value="my-applet.jnlp"/>
</object>
However this does not grab the jnlp_href with Java plugin turned off in the Java console.
If the applet does not need to be embedded in the web page, it can be launched free-floating from the first versions of Java Web Start (available as a separate download around Java 1.2). It is only in the Next Generation JRE that a JWS deployed applet can remain embedded in a web page.

Passing arguments on a jnlp file

Is it possible to pass maven-like arguments on a JNLP file?
<jnlp spec="1.0+" codebase="${javafxCodebase}" href="Foo.jnlp">
<information>
<title>${javafxTitle}</title>
<vendor>${javafxVendor}</vendor>
...
</information>
...
</jnlp>
And if so, who will pass these data to the jnlp file? What comes to mind is:
http://localhost:8080/Foo.jnlp?javafxCodebase=bar&javafxTitle=baz
There is no support for this out of the box with Java Webstart. There is a JNLP Download Servlet but it only supports a limited set of macros and cannot have any that are user defined.
I think your best approach would be to use a templating engine like Velocity to write your own servlet for generating the JNLP file on the fly and populating it with your required arguments.
You can also try the php script on this website.
I found it useful to automatically detect my codebase url, since I had a requirement to deploy the jnlp files on different servers.

Dynamic JNLP Generation and invocation from Excel

I have an application which is invoked via Java Webstart. Opening it via the Webstart link works without any issue.
I also have an application based on Excel that generates files (via vba) which can then be opened by the program that starts via Webstart.
What I would like to do is have a button that invokes the Webstart application and then opens a newly generated file. The files name (and contents) are time sensitive and so I can't use the same file name over and over.
I've pretty much figured out how to use vba to invoke the application via Webstart but the problem is that for the Webstart app to be able to open a file it needs to be passed in as an argument in the jnlp descriptor
<application-desc main-class="com.foo.WebstartApp">
<argument>-file</argument>
<argument>C:\files\file_20100909_164834.csv</argument>
</application-desc>
How do you go about passing through the filename into the JNLP file when the filename will always be different?
Should I be looking at dynamically generating a new jnlp file each time, or is there a way to parameterize the jnlp file and pass through the filename when invoking the JNLP?
Dynamically generated JNLP files is probably going to open you up to injection attacks, just like dynamic SQL. Further it looks as if you are expecting the user to trust the WebStart application which trusts the JNLP file which is untrustworthy.
Assuming you have one application instance per desktop (SingleInstanceService), information about which files to use, which should not necessarily be trusted, can be passed through an applet using the PersistenceService ("muffins") or, apparently if the browser is IE, through cookies.
I've found a solution that suits my needs. A custom servlet is used to modify parameters in the URL string.
http://forums.sun.com/thread.jspa?threadID=714893

Can I invoking java web start in program?

I want to make use of the java web start advantage,but I dont want our customer face the java web start loading Screen,it seems ugly...and also customer maybe not install jre and the jre-install maybe fussy to them..so I want to package our application and jre into setup file using installanywhere. when user start our program,I want to invoking web start API to do the work like version compare,and offer outself loading screen ..
so,Can I invoking web start in my program?and how?
Best regards
L.J.W
I don't think web start is the way you want to go here. You can't change the loading screen, and if you want to access the user's computer in any way you'll have to bother the user with a confirmation, and risk them freaking out and canceling. Just roll your own auto-update; it's definitely not worth using web start just for that.
For the loading screen question:
<jnlp ...>
<information>
<icon kind="splash" href="splash.gif" />
...
</information>
...
</jnlp>
If you're installing your application locally on the user's machine, why would you need to call JWS?

Categories