1

I have a requirement where a jar deployed onto client side needs to be executed when a user click on a link on web page [it's an internal webpage]. To elaborate, I have a web page which provides details regarding multiple products, now when individual product owners click on their products then product specific jars need to be executed to open Swing UI.

I have done analysis on this and none of frameworks of libraries allow this due to security reasons from Run EXE from client side.

I suggested to perform this using applet but people are not keen on it.

EDIT: Reason for excluding applet is that people are not keen on deploying jar on server. They want to deploy jar on client side and then execute it.

EDIT: Reasons for not being keen on downloading jar are:

  1. Jar is huge, in some cases around 100 mb.
  2. If jar has to be deployed on to web server then a dependency gets added which products want to avoid because they do not want to sync up with release cycle of web application.

Are there any options to execute client side code under some checks? For example: Setting a particular IP address as secured in order to by pass security checks.

Community
  • 1
  • 1
Lokesh
  • 7,810
  • 6
  • 48
  • 78
  • 2
    have you looked at Java Webstart? – planetjones May 05 '13 at 08:49
  • 2
    Have you lookd at Java Web Start? – MadProgrammer May 05 '13 at 08:49
  • Nope, let me analyse that as well – Lokesh May 05 '13 at 08:50
  • The best link for JWS is http://stackoverflow.com/tags/java-web-start/info ;) – Andrew Thompson May 05 '13 at 08:50
  • @AndrewThompson: At first look it seems JWS will work almost like applet. It will download the jar from server. Is that correct? The issue people donot want to download the jar, they want pre-installed jar to be executed. – Lokesh May 05 '13 at 08:56
  • *"People do not want to download the Jar"* ... Think of this as apart of the installation process. – MadProgrammer May 05 '13 at 09:05
  • @MadProgrammer: What if jar changes? whole process will be repeated and release cycles will have to be synced with web app. This is where the whole issue lies. Products want complete independence. – Lokesh May 05 '13 at 09:14
  • @loki As I understand it, JWS has a upgrade path as well. The question revolves around more about the perception of what the user defines "install" and "download" as (and really bad press about the applet plugin) – MadProgrammer May 05 '13 at 09:25

2 Answers2

2

Java Web Start is probably the way to go for this deployment.

The issue people do not want to download the jar, they want pre-installed jar to be executed

The point is that 'the user' does not download the Jar, instead that is done invisibly by the JWS client that runs the launch file the user clicked. Try my JWS version of GIFanim for an example of the experience.

Note that even though that app. is sand-boxed, there are still prompts before it reaches the screen. Since version 1.7.0_21 those prompts apply to both applets & JWS apps.


Ultimately, there is no way to run a Swing based app. before the Jar is downloaded. E.G.:-

  1. User downloads executable Jar & runs it. They need to download the Jar in a situation where it is clear the Jar is being downloaded.
  2. Applet. The JVM will be invoked when the applet element (or equivalent) appears in a web page. The JVM will download & cache the Jar - relatively invisible to the user, excepting the 'loading..' progress bar in the applet.
  3. Java Web Start. The JWS client will be invoked when the user clicks a link to a JNLP file. That JNLP will be cached locally, then the resources (Jars etc.) will be cached locally, then the app. will be run. Again, relatively invisible to the user, barring the download time and any related progress indicator (which JWS does by default).

..when individual product owners click on their products then product specific jars need to be executed to open Swing UI.

You would have a JNLP for each 'more specific' app. as well, then you might use the BasicService of the JNLP API to invoke the relevant app. by opening the JNLP of that app. Here is a demo. of the BasicService.

Community
  • 1
  • 1
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • Reasons for not being keen on downloading jar are: 1. Jar is huge, in some cases around 100 mb. 2. If jar has to be deployed on to web server then a dependency gets added which products want to avoid becuase they donot want to sync up with release cycle of web application. This makes me feel JWS will not solve the issue. Do you agree? – Lokesh May 05 '13 at 09:09
  • @loki Unless you can use a 'small' client to connect to a **web app.** (e.g. servlets, RMI) that can itself use the 100 meg. Jar, there is simply **no way** for a Swing client to run that Jar locally, or use it's functionality, unless it is downloaded. What does the 100 meg Jar do, specifically? What API is it? ***Why is it so large?*** – Andrew Thompson May 05 '13 at 09:17
0

use web start

see this link

http://www.oracle.com/technetwork/java/javase/overview-137531.html

web start allows the client to run java application where the jar reside on the web

aymankoo
  • 653
  • 6
  • 12
  • As the top answer provider for JWS, I recall reading that page and at the end thinking ..and WTF is JWS?!? OTOH I incorporated my best experience of JWS into the [Java Web Start info. page](http://stackoverflow.com/tags/java-web-start/info) here at SO. I think it also links to that page (and many more useful ones). – Andrew Thompson May 05 '13 at 08:53
  • *"where the jar reside on the web"* It starts on the web, but is cached locally before being run. – Andrew Thompson May 05 '13 at 08:53
  • @aymankoo: This will not solve the issue. The issue is people donot want to download the jar, they want pre-installed jar to be executed. – Lokesh May 05 '13 at 09:03