wood burning stoves 2.0*
The moose likes JNLP and Web Start and the fly likes JWS - A Good Way To Demo Apps Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JNLP and Web Start
Bookmark "JWS - A Good Way To Demo Apps" Watch "JWS - A Good Way To Demo Apps" New topic
Author

JWS - A Good Way To Demo Apps

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Since my forum is rather slow, I thought I would add a little opinionated article about how I feel about Java Web Start.
Java Web Start is an excelent way to demo your applications. I think most people will agree that Applets are their last leg. They are slow and getting them to load correctly in different browsers can sometimes be a pain.
Enter Java Web Start. JWS has been distributed with the JRE I believe since 1.3. It is an excelent way to demo your applications over the web. It is simple to set up and your application requires absolutly no special coding what-so-ever. The only thing you may need to do is use jarsigner to sign your application since applications using JWS fall in the same Security Sandbox as Applets. But if there is no client machine interaction, you don't need to do this.
Anyway, this beats having someone download your JAR file themselves and try and run it. I know we all try and provide good instructions, but people don't always read them or understand them anyway. With Java Web Start, you just click on a link and wham!! It runs.
So that's it for Java Web Start.


GenRocket - Experts at Building Test Data
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
hi gregg,
well, if we really don't have anything in the code that needs "signed" application then we don't have to sign the application, right?
and i would little get back when one suggests that JWS is easier to install. well, if we already run JWS1.1 on our machine and JRE1.4.0 and we want to have JRE1.4.1 and JWS1.2 then it doesn't work simply "plug-n-play" way you know. it gave me "In correct installation" error first time. i had to go there in JWS panel and configure the "Java" tab to use only "JRE1.4.1" out of two JRE i was having "1.4.0" and "1.4.1" . and on Windows 2000 i had to install SP2 first as JRE1.4.1 doesn't work otherwise for installing 1.4.1.
i could do all of these w/o hassel as i'm a developer but i had to go thru a phone call to have my manager's system configured and i can't think of end users you are right- people never seem to read instructions even if they are simple
regards
maulin.
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
but sure...
i would agree that it is "browser independent" and i know that applets behave differently on different browsers...
(i still have to make my applet run properly on NN...it stops working...the edit pane becomes disabled...what not...)...
regards
maulin.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Maulin Vasavada:
hi gregg,
well, if we really don't have anything in the code that needs "signed" application then we don't have to sign the application, right?

That is correct.
As far as your other problem...I wonder why your manager had different versions of the JRE installed. The typical user probably won't. So they shouldn't have a problem. And if they have an earlier version of JRE you can force a download and it will set itself as the default in the VM Console.
But I would be interested in hearing more problems you are having with JWS. That way I can handle questions better.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Maulin Vasavada:
but sure...
i would agree that it is "browser independent" and i know that applets behave differently on different browsers...
(i still have to make my applet run properly on NN...it stops working...the edit pane becomes disabled...what not...)...
regards
maulin.


Yes, getting applets to behave correctly can sometimes be a pain. And JWS Apps are browser independent because the app doesn't run inside the browser. It runs as a desktop application. Which is why I prefer them over applets.
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
Alright Gregg,
i am starting to prepare a list of observations i made about analysing "replacing an applet with corresponding JWS application". here are those. please feel to comment/add/remove/subtract...all valid math operations on the list..:-)
1. Support for Multiple JRE
- Applet runs in a browser hence the JRE use is restricted to one
JRE at a time in one browser. This might result into problems if
we have other applications that requires other JREs. We have to
switch between JREs to run each of the applications in that case.
- JWS handles multiple JREs on its own. So, we don't end up chaning
the configuration for JRE everytime.
2. Web connectivity
- Applet run in a browser and hosted on a site so requires web
connection to run.
- JWS may not require web connection depending upon the application.
3. Browser issues for support
- Applet may behave differently on different browsers. Also, there
are issues with using Swing Applets in the browser as OBJECT and
EMBED tags supported by IE and NN respectively behave differently.
e.g. EMBED tag's NAME attribute is equivalent of ID attribute in
OBJECT tag but with NAME attribute we can't invoke the applet's
public methods which we can invoke using ID attribute in OBJECT.
This is because EMBED tag doesn't consider the item as an Java
Applet (application/x-java-applet) which can be confirmed by
using JavaScript's method - alert(document.applets.length);
- No such differences issue as JWS runs on a local machine as a
stand alone application.
4. Sandbox- Policy files
- In case of Applet if needed user or the system admin on the local
network has to manage policy files (java.policy).
- JWS manages the policy files?? <<YET TO MAKE SURE>>
5. Accessibility/Ease of use
- Applet is on the Webpage so we can't create a application short-cut
or something.
- JWS applications can have short-cuts on desktop etc for prompt access.
6. Logging of messages
- Applet only allows logging of messages on the "Java Console" by default.
- JWS enable us to specify where the log messages should be put- on the
Java Console or a file.
7. Mime-Type settings
- Applet doesn't need special mime-type settings on most web servers or
browsers.
- JWS application works with JNLP which requires special mime-type
settings for JNLP file support on the web server as well as the browser.
8. Communication with other entities
- Applet can have a communication with RMI objects, other Applets, CORBA,
database, sockets to the hosting host, JavaScript, Servlets/JSPs etc.
Each of these possible type of communication needs to be considered to
see if we can really replace the Applet application with the corresponding
JWS.
- For an example, JWS can't take advantage of communication with JavaScript
as the application doesn't run into browser anymore and this might be
crucial if "Applet/JavaScript communication" is MUST.
Similarly, how a stand-alone application can use "file upload" utility that
exists in HTTP via "multipart- form" request. We can use Applet-Servlet/JSP/HTML
combination to achieve the file upload utility from an Applet but we can't use
JWS to post "Multipart-form" request as it can be only handled by HTTP
client (a webbrowser).
regards
maulin
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
hi,
also, this link might be more helpful.
1. jws forum

regards
maulin.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Maulin Vasavada:
Alright Gregg,
7. Mime-Type settings
- Applet doesn't need special mime-type settings on most web servers or
browsers.
- JWS application works with JNLP which requires special mime-type
settings for JNLP file support on the web server as well as the browser.
8. Communication with other entities
- Applet can have a communication with RMI objects, other Applets, CORBA,
database, sockets to the hosting host, JavaScript, Servlets/JSPs etc.
Each of these possible type of communication needs to be considered to
see if we can really replace the Applet application with the corresponding
JWS.
- For an example, JWS can't take advantage of communication with JavaScript
as the application doesn't run into browser anymore and this might be
crucial if "Applet/JavaScript communication" is MUST.
Similarly, how a stand-alone application can use "file upload" utility that
exists in HTTP via "multipart- form" request. We can use Applet-Servlet/JSP/HTML
combination to achieve the file upload utility from an Applet but we can't use
JWS to post "Multipart-form" request as it can be only handled by HTTP
client (a webbrowser).
regards
maulin

#7 - Most Web Servers are already setup with the correct MIME-TYPES for JNLP. However, mine was not, but my Web Hosting Company provides the ability to define my own MIME-TYPES. No Big deal.
#8 - Java Applications can communicate with all specified technologies except Javascript. As far as the goes, your Web Based Form becomes a SWING Form so form requests via javascript are no longer needed. And Servlets are easily communicated with via SWING applications. Just by using URLConnection.
Thomas Hubschman
Ranch Hand

Joined: Sep 25, 2002
Posts: 88
Hey All,
Does anyone have a link to a demo of a good implementation of a JWS demoed application? One that has the code and all?
Thanks,
Tom


SCJP '02, SCWCD '02, SCJD '08, SCSNB '09, SCEA '10
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Thomas Hubschman:
Hey All,
Does anyone have a link to a demo of a good implementation of a JWS demoed application? One that has the code and all?
Thanks,
Tom

http://java.sun.com/products/javawebstart/demos.html
Those are demos from Sun.
http://www.croftsoft.com/portfolio/collection/install/?
That has a JWS App that has some games and what not.
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
Hi Gregg,


#8 - Java Applications can communicate with all specified technologies except Javascript. As far as the goes, your Web Based Form becomes a SWING Form so form requests via javascript are no longer needed. And Servlets are easily communicated with via SWING applications. Just by using URLConnection.


about the point#8,
i tried to put this in more general manner. actually, i face this problem. to be specific to my application,
i have an applet that has "preview" option for the HTML page that was edited via my applet. that option basically creates a temporary file on the server and when we say "preview" a window "without locationbar, menubar" pops up showing the page from the webserver (via JSP). i do this via JavaScript's window.open() method from the Applet. I call a method showPreview() in my JavaScript passing the appropriate parameters from the applet and then JavaScript pops up the window.
the issue here is- without JavaScript i didn't find ANY way of having a window popup "without locationbar, menubar"..you know.. we can use showDocument() method of JNLP API to popup a browser window and open some URL in there (which is similar to AppletContexts method showDocument()) but the limitation is- "we can't have a window without locationbar, menubar". i researched this issue "why we don't have that facility in showDocument()?" and it seems the reason is- it is the Browser execution. we don't have a command line switch/option for the browser exe (not for IE nor for NN) that says "open window without locationbar or menubar" you know. that is the problem.
do you see what i am facing?
actually, i tried to think what it would take to convert my applet to standalone application and use JAWS to avoid applet problems but couple of issues like this stops me doing that.
also, there is another issue i observed,
"how can we submit multipart-form request via java interface?" we can't. we have to have HTTP Client code that can form proper request object for multipart-request handling. i found one on the internet called HTTPClient written in java but we certainly would like to avoid inclusion of may external packages to reduce the requirements and code size. this multipart-form request i need as we have "Upload" option in my applet. that popsup an html that has a form submission via multipart-form request (again that popup doesn't have menubar, locationbar etc)...
regards
maulin.
Bhupinder Dhillon
Ranch Hand

Joined: Oct 12, 2000
Posts: 124
Originally posted by Maulin Vasavada:
we don't have a command line switch/option for the browser exe (not for IE nor for NN) that says "open window without locationbar or menubar" you know. that is the problem.

Netscape has command line options for that. The only problem is - it only works if netscape hasn't already started yet.
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
hi Bhupinder,
i know the link u provided but i 'm not able to see how i can say "open window with no location bar and no menubar"...
can u tell me if u know how to do it?
i am interested in that even if it is only NN specific..
thanks
maulin.
Bhupinder Dhillon
Ranch Hand

Joined: Oct 12, 2000
Posts: 124
Try -k switch
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
hi,
that is kiosk mode , right?
i want exactly the same functionality as JavaScript's...
window.open('mypage','my.html','location=no,menubar=no'); you know..
btw, i might sound 'pig headed' but its not me its the clients who will want to c the same behavior as it was earlier (when we were using the JavaScript to open the window from the applet) you know
and i fear, if i open things in kiosk mode first time they will get scared - "where the heck did other things suddenly disappeared"
regards
maulin.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

You might try finding a solution to this in the Applet forum as this seems out of the scope of Java Web Start.
The reason I say that is because if you NEED Browser interaction as far as Javascript, etc, don't use JWS. Use an Applet.
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
hi Gregg,
well, i raised that issue as we were discussing pros-cons of JWS (atleast i was as i listed points of consideration before switching to JWS based application instead of a an Applet).
the conclusion is certainly what you indicated in the last post.
i surely don't want to pose this problem as a question to this forum as it is an Applet question.
lets keep on with more users in this thread providing input on JWS problems if they face.
regards
maulin.
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2578

Gregg,
I believe unlike applets, application launched using JWS can store and read some information on the user machine in a text file similar to cookies, this has got me interested in JWS. Can you please provide some more info on how this can be done?
TIA,
- Manish
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Actually, JWS apps are in the same security sandbox as applets. So your JNLP file must be configured to allow access to the local files system as well as your JWS app must be digitally signed.
This was originally a problem for me, as applets were, but signing a jar file with your own cert is really easy. The problem will be random users trusting your cert if you don't purchase one and just create your own.
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871


Can you please provide some more info on how this can be done?


hi manish,
u can try PersistenceService for the thing u mentioned. look at the JNLP API for that purpose.
i remember i downloaded some application from sun site may b that had the code with example for the JNLP API...try on google to find it..
its there in my office comp and today is sunday so i'm home..
regards
maulin
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2578

Thanks Maulin, I'll have a look at PersistenceService API!
- Manish
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JWS - A Good Way To Demo Apps
 
Similar Threads
Webstart and language specific text files
The HttpServletRequest.getRemoteUser() method.
Future of the Desktop App.
Java web start
can you create normal programs/exe's in Java?