Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Java Web Start & JNLP

Posted on 2001-07-19
12
Medium Priority
?
332 Views
Last Modified: 2012-06-27
Hi everybody!

     I'm using an application with Java Web Start and, of course, I've created a JNLP file.
The problem is that my application use an external text file, and I don't know how to "tell" Java Web Start to download this file too, when I'm starting the application.

I guess the problem is in JNLP's configuration. I don't know how to configure this JNLP file to specify that I need an external resource for my application.

Can anyone help me ?

Thanx a lot.
Sam
0
Comment
Question by:asimion
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 9

Expert Comment

by:Ovi
ID: 6298102
Why don't you put all files (the app and the txt) in a global .jar file ?
0
 

Expert Comment

by:LG_Goundalkar
ID: 6298105
Hi..
Try this..

import javax.jnlp.*;
    ...

    DownloadService ds;

    try {
        ds = (DownloadService)ServiceManager.lookup("javax.jnlp.DownloadService");
    } catch (UnavailableServiceException e) {
        ds = null;
    }

    if (ds != null) {

        try {
            // determine if a particular resource is cached
            URL url =
                    new URL("http://localhost\file location
            boolean cached = ds.isResourceCached(url, "1.0");
            // remove the resource from the cache
            if (cached) {
                ds.removeResource(url, "1.0");
            }
            // reload the resource into the cache
            DownloadServiceListener dsl = ds.getDefaultProgressWindow();
            ds.loadResource(url, "1.0", dsl);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

LGG

0
 

Author Comment

by:asimion
ID: 6298532
Hi LGG,

     I've tried your code but it doesn't seem to download the file. I don't receive any error but I don't get the file either. How can I know if the download was succesfully and how can I acces the downloade file ?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 92

Expert Comment

by:objects
ID: 6300538
If you put the file in your jar then you can simply read it using:

InputStream in = ClassLoader.getSystemResourceAsStream("filename.txt");

// Read your file from input stream


0
 

Author Comment

by:asimion
ID: 6301011
I don't want to use the file inside the jar !
I now this way it's working, because the file will be downloaded by JavaWebStart. But I need the file outside the jar because will be modified very often, and I don't want to modify the whole jar every time.
0
 
LVL 92

Expert Comment

by:objects
ID: 6301021
Then you'll need to make it available somewhere for download, as far as I know Web Start doesn't support additional resources.
Will check for u.
0
 

Author Comment

by:asimion
ID: 6301035
The txt file is in the same directory with the jar file and the JNLP file on the server.

If I try to download the file like this :

http://servername/filename.txt with any browser, it's working!

So, that mean it's available for download...., isn't it ?
0
 
LVL 92

Expert Comment

by:objects
ID: 6301042
JNLP only supports specifying jars, images, and other jnlp's. So you'll need to jar your external text file for jnlp to grab it.

Something like this:

<resources>
  <jar href="http://abc.com/text.jar"/>
</resources>

Then use the standard getResource methods in your code to access your data.

If you need more info have a look at the JNLP spec.

0
 
LVL 92

Expert Comment

by:objects
ID: 6301046
That does mean its available for download.
0
 
LVL 1

Expert Comment

by:sey7
ID: 6305195
Maybe you can ask Sey again to solve the problem.


Best Regards,   :)
0
 
LVL 5

Expert Comment

by:vemul
ID: 7669629
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
- To be PAQ'ed and points NOT refunded
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

vemul
Cleanup Volunteer
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 7714630
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question