Skip to main content

Web Start with multiple JAR files

7 replies [Last post]
Anonymous

I am having some problems with Web Start and multiple JAR files. If this is answered by the FAQ/docs I am sorry, but I haven't found it in there.

Situation:
I have a Java application that uses X jar files. One jar file is the "master jar", where the basic application and resources are in, the other jar files are optional plugins which are downloaded with the application.

My questions:
1.) Is this possible with the current version of Web Start?
2.) When I add a jar file on the server, is there an option in Web Start like "get all jar files from directory x to the client?"

Thanks in advance,

Patrick

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Anonymous

OK, I am having still problems with WebStart and multiple JAR files.

I added

[code]




[/code]

to my jnlp file, now I can see the files in the cache. So far so good ;) And I changed my plugin loader not to check for the file name, now I am loading all .JAR files in the current directroy and check for an INI file in there where the entry class anmes etc are defined. That works too, at least when I start the application form console.

But now: When I start the app with WebStart it works until the plugins are loaded then it suddenly quits. I added some printouts, but I cannot see anything in the Java console from WebStart. Somewehre the application just got lost.

I assumed that the current directory of a WebStart app is the cahce directory where the files are in, is this right or does WebStart "link" the files to another location?

Thanks,

Patrick

Anonymous

Oh I think I got it, it's the ClassLoader! I am using my own version to load classes from a jar file, it doesn't seem to run from WebStart.

khifa_monqius
Offline
Joined: 2008-06-06

hi

i also got the same problem. so how u manage to solve that problem with the class loader /

are u using Class.forName("") instead of jarClassLoader.loadClass() ?

thank you

hope to hear from u soon.

combyses
Offline
Joined: 2006-02-17

If I understand your question correctly, the solution is to include the following lines in your .jnlp file that launches the application:





master.jar gets loaded everytime you change it. The lib1.jar and lib2.jar are loaded only once.

Hope this helps.

Anonymous

> If I understand your question correctly, the solution
> is to include the following lines in your .jnlp file
> that launches the application:
>
>
>
>
>
>

>
> master.jar gets loaded everytime you change it. The
> lib1.jar and lib2.jar are loaded only once.

Thanks for your reply, but this is not quite what I am looking for. To be more specific, the problem - at least I think so - is related in the plugin / file mechanism.

My plugin framework works this way:
The plugin loader class scans the directory ../plugins/ for all .jar files. File name and class name must be the same, so take UI.jar for example must have a class UI.class inside.

After the classes were downloaded via JNLP the file name change, at least from what I saw in the cache directory. UI.JAR changes to something like DMXUI.jar. Here my class loader comes in trouble and can't find back it's plugin classes. I hope there is a way without rewriting the plugin mechanism, I just wanted to show web start easy distribution to a client.

zander
Offline
Joined: 2003-06-13

> My plugin framework works this way:
> The plugin loader class scans the directory
> ../plugins/ for all .jar files. File name and class
> name must be the same, so take UI.jar for example
> must have a class UI.class inside.

That approuch indeed is not scalable; it should also be legal to rename a jar file, so I suggest you fix your plugin structure.
I wrote a plugin structure where I always expect a plugin.ini file in the root of the jar, and get my settings from there.

Anonymous

> That approuch indeed is not scalable; it should also
> be legal to rename a jar file, so I suggest you fix
> your plugin structure.
> I wrote a plugin structure where I always expect a
> plugin.ini file in the root of the jar, and get my
> settings from there.

Yes you are right. I basically know that my approuch is not very clever. But if there is a way to keep web start from renaming the JAR files it would be great for the moment. I am having a date with my client this evening and wanted to show the web start solution as a nice enhancement. Just didn't want to play too much with my sources before visiting him ;)