Need to revise my JNLP file

R

Ramon F Herrera

Greetings to all. Long time no see. I am wearing my Java developer hat
again.

It has been a while since the last time I deployed my apps through
JNLP, and something is not working properly. I need a sanity check.

This what I have done so far.

(1) I took the sample file below from the Java site.

Question 1: The lines where the "codebase" and "href" are defined are
really a self-reference, correct? IOW: The concatenation of "codebase"
and its "href" should provide the JNLP file in question, right? This
is like a file containing its filename inside.

(2) I assume that I have to modify 4 lines:

(2a) The line where "codebase" is defined
(2b) The line where the first "href" is defined
(2c) The line where "jar href" is defined
(2d) The line where "application-desc main-class" is defined.

Am I doing anything wrong this far?

TIA,

-Ramon


------------------------------------------------

http://java.sun.com/docs/books/tutorial/deployment/webstart/deploying.html

<?xml version="1.0" encoding="utf-8"?>
<!-- JNLP File for Notepad -->

<jnlp spec="1.0+"
codebase="http://java.sun.com/docs/books/tutorialJWS/deployment/
webstart/examples/"
href="Notepad.jnlp">
<information>
<title>Notepad Demo</title>
<vendor>The Java(tm) Tutorial: Sun Microsystems, Inc.</vendor>
<description>Notepad Demo</description>
<homepage href="http://java.sun.com/docs/books/tutorial/
deployment/webstart/running.html"/>
<description kind="short">ClickMeApp uses 3 custom classes plus
several
standard ones</description>
<offline-allowed/>
</information>
<resources>
<jar href="Notepad.jar"/>
<j2se version="1.6+"
href="http://java.sun.com/products/autodl/j2se"/>
</resources>
<application-desc main-class="Notepad"/>
</jnlp>
 
J

John B. Matthews

Ramon F Herrera said:
Greetings to all. Long time no see. I am wearing my Java developer hat
again.

It has been a while since the last time I deployed my apps through
JNLP, and something is not working properly. I need a sanity check.

This what I have done so far.

(1) I took the sample file below from the Java site.

Question 1: The lines where the "codebase" and "href" are defined are
really a self-reference, correct? IOW: The concatenation of "codebase"
and its "href" should provide the JNLP file in question, right? This
is like a file containing its filename inside.

(2) I assume that I have to modify 4 lines:

(2a) The line where "codebase" is defined
(2b) The line where the first "href" is defined
(2c) The line where "jar href" is defined
(2d) The line where "application-desc main-class" is defined.

Am I doing anything wrong this far?

I think so. I just moved several JARs to Google Sites. The essential
change was using a full URL for the href attribute of <jar/>. The
example shows a path relative to the <jnlp/> codebase attribute, but
that failed to get past Google redirection.

For example, <http://sites.google.com/site/drjohnbmatthews/subway>:

<?xml version="1.0" encoding="utf-8"?>
<!-- JNLP File for Subway -->
<jnlp spec="1.0+"
codebase="http://sites.google.com/site/drjohnbmatthews/subway"
href="Subway.jnlp">
<information>
<title>Subway</title>
<vendor>John B. Matthews.</vendor>
<description>Subway Simulation</description>
<homepage href="http://sites.google.com/site/drjohnbmatthews/subway"/>
<description kind="short">Subway Simulation</description>
<offline-allowed/>
</information>
<resources>
<jar href=
"http://sites.google.com/site/drjohnbmatthews/subway/Subway.jar"/>
<j2se version="1.5+" href="http://java.sun.com/products/autodl/j2se"/>
</resources>
<application-desc main-class="Subway"/>
</jnlp>
 
R

Ramon F Herrera

I think so. I just moved several JARs to Google Sites. The essential
change was using a full URL for the href attribute of <jar/>. The
example shows a path relative to the <jnlp/> codebase attribute, but
that failed to get past Google redirection.

For example, <http://sites.google.com/site/drjohnbmatthews/subway>:

<?xml version="1.0" encoding="utf-8"?>
<!-- JNLP File for Subway -->
<jnlp spec="1.0+"
 codebase="http://sites.google.com/site/drjohnbmatthews/subway"
 href="Subway.jnlp">
 <information>
  <title>Subway</title>
  <vendor>John B. Matthews.</vendor>
  <description>Subway Simulation</description>
  <homepage href="http://sites.google.com/site/drjohnbmatthews/subway"/>
  <description kind="short">Subway Simulation</description>
  <offline-allowed/>
 </information>
 <resources>
  <jar href=
   "http://sites.google.com/site/drjohnbmatthews/subway/Subway.jar"/>
  <j2se version="1.5+" href="http://java.sun.com/products/autodl/j2se"/>
 </resources>
 <application-desc main-class="Subway"/>
</jnlp>

Thanks for the tip, John. After following your suggestion, I am making
progress: now the app starts, but its libraries seem to be absent,
even after I used fully qualified URLs.

Regards,

-Ramon
 
R

Roedy Green

(2) I assume that I have to modify 4 lines:

(2a) The line where "codebase" is defined
(2b) The line where the first "href" is defined
(2c) The line where "jar href" is defined
(2d) The line where "application-desc main-class" is defined.

In the Replicator, I generate the JNLP file with Java code. If you
did it that way, you would have to modify only one field, and your
Java code would make all the necessary adjustments.
--
Roedy Green Canadian Mind Products
http://mindprod.com

"For reason that have a lot to do with US Government bureaucracy, we settled on the one issue everyone could agree on, which was weapons of mass destruction."
~ Paul Wolfowitz 2003-06, explaining how the Bush administration sold the Iraq war to a gullible public.
 
J

John B. Matthews

[...]
Thanks for the tip, John. After following your suggestion, I am
making progress: now the app starts, but its libraries seem to be
absent, even after I used fully qualified URLs.

You can list multiple JAR files or use the extension mechanism. See "Can I
rely on Class-Path in the manifest file?":

<http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/faq.html>

Here's an example that uses extensions for jogl and joal JARs:

<http://www.bytonic.de/downloads/jake2_jogl11.jnlp>
 
J

Jeffrey H. Coffield

Ramon said:
Question 1: The lines where the "codebase" and "href" are defined are
really a self-reference, correct? IOW:

I think the reason they are a self reference is that when a browser
loads a jnlp file, it saves a copy to its cache area and then invokes
the java application manager passing that local file name. The manager
then checks to see if the local copy is the same as the remote but it
was only given the local name so it needs the remote name to be in the
jnlp file.

Can someone else confirm this?

Jeff Coffield
 
R

Roedy Green

Can someone else confirm this?

Just one other datapoint. If you look at the JNLP file with the
jawaws viewer, you will see the cached version has been modified from
the actual posted version.
--
Roedy Green Canadian Mind Products
http://mindprod.com

"For reason that have a lot to do with US Government bureaucracy, we settled on the one issue everyone could agree on, which was weapons of mass destruction."
~ Paul Wolfowitz 2003-06, explaining how the Bush administration sold the Iraq war to a gullible public.
 
R

Roedy Green

(2a) The line where "codebase" is defined
(2b) The line where the first "href" is defined

I use the codebase to define the directory within the website where
the files are and the href to define the individual files within that
directory.
--
Roedy Green Canadian Mind Products
http://mindprod.com

"For reason that have a lot to do with US Government bureaucracy, we settled on the one issue everyone could agree on, which was weapons of mass destruction."
~ Paul Wolfowitz 2003-06, explaining how the Bush administration sold the Iraq war to a gullible public.
 
R

Ramon F Herrera

Greetings to all. Long time no see. I am wearing my Java developer hat
again.

It has been a while since the last time I deployed my apps through
JNLP, and something is not working properly. I need a sanity check.

This what I have done so far.

(1) I took the sample file below from the Java site.

Question 1: The lines where the "codebase" and "href" are defined are
really a self-reference, correct? IOW: The concatenation of "codebase"
and its "href" should provide the JNLP file in question, right? This
is like a file containing its filename inside.

(2) I assume that I have to modify 4 lines:

(2a) The line where "codebase" is defined
(2b) The line where the first "href" is defined
(2c) The line where "jar href" is defined
(2d) The line where "application-desc main-class" is defined.

Am I doing anything wrong this far?

TIA,

-Ramon

------------------------------------------------

http://java.sun.com/docs/books/tutorial/deployment/webstart/deploying...

<?xml version="1.0" encoding="utf-8"?>
<!-- JNLP File for Notepad -->

<jnlp spec="1.0+"
      codebase="http://java.sun.com/docs/books/tutorialJWS/deployment/
webstart/examples/"
      href="Notepad.jnlp">
   <information>
      <title>Notepad Demo</title>
      <vendor>The Java(tm) Tutorial: Sun Microsystems, Inc.</vendor>
      <description>Notepad Demo</description>
      <homepage href="http://java.sun.com/docs/books/tutorial/
deployment/webstart/running.html"/>
      <description kind="short">ClickMeApp uses 3 custom classes plus
several
       standard ones</description>
      <offline-allowed/>
   </information>
   <resources>
        <jar href="Notepad.jar"/>
        <j2se version="1.6+"
              href="http://java.sun.com/products/autodl/j2se"/>
   </resources>
   <application-desc main-class="Notepad"/>
</jnlp>


This is a follow-up question, related to JNLP development.

It seems that my debugging may be affected by running a version(s)
from the cache. I am not sure if the cached stuff is the remote JNLP
file, the downloaded (hopefully) executable JAR and/or the auxiliary
JARs with libraries and images.

How can I make sure that only the latest and greatest versions are
being used?

Isn't there a way to use a version number to force download and use of
the most recent version?

TIA,

-Ramon
 
A

Andrew Thompson

..
This is a follow-up question, related to JNLP development.

Why was it necessary to quote the entire original
post in the follow-up question?
It seems that my debugging may be affected by running a version(s)
from the cache. I am not sure if the cached stuff is the remote JNLP
file, the downloaded (hopefully) executable JAR and/or the auxiliary
JARs with libraries and images.

How can I make sure that only the latest and greatest versions are
being used?

Well, I'm not so sure about debugging off the site,
but generally during development, I launch a local
version of the app. and override the codebase at
runtime.

If you are concerned about Jar versions, insert an
Implementation-Version in the manifest of each Jar.
JNLP versions, add a property or argument to the
JNLP file. Log both at runtime.

AFAIU, the JNLP servlet provides ways to get over a
lot of caching problems, but I have not had cause to
use it yet.

If you really need to absolutely guarantee a fresh
install, try temporarily moving the Java cache
location. That will get around both Jar and JNLP
caching (so long as you are not fool enough to try
launching the app. from an existing menu item or
desktop shortcut).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,735
Latest member
HikmatRamazanov

Latest Threads

Top