aspose file tools*
The moose likes JNLP and Web Start and the fly likes Searching for a resource Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JNLP and Web Start
Bookmark "Searching for a resource" Watch "Searching for a resource" New topic
Author

Searching for a resource

Greg Fidster
Greenhorn

Joined: Dec 08, 2004
Posts: 10
Greetings,

I am launching a desktop application via webstart.
One of the features of the application is dynamically creating menu items by searching for a my-plug-in.xml file and grabbing the plugin parameters. Basically the idea is so developers can create their own applications, package them in jars with my-plug-in.xml, and my application will find the plug in file and add their application to the desktop environment.

problem is, i can't find any feature to search through the resources in a webstart launch. the resource loader works fine provided you know the full classpath com/mydomain/app/my-plug-in.xml. if multiple my-plug-in.xml files are packaged without classpath identification, then the loader will just pick the first one.

any solutions? i want a list = getResources("*/my-plug-in.xml") method!

thanx
greg
Cristian Negresco
Ranch Hand

Joined: Sep 15, 2001
Posts: 182
Hi,

One should search through the application jars, list the contents of the jars and find the resources which match the needed pattern. After that the retrieval could be made with getResourceAsStream, or something like that.
Busy now...;0), if problems with any of the steps let us know.

BR,
Cristian
Greg Fidster
Greenhorn

Joined: Dec 08, 2004
Posts: 10
Hi Christian,

thanks for the reply. thats what i was doing initially running the application from my desktop, unfortunately it doesn't scale to a webstart launch quite so easily. running from the desktop it's easy to get the current folder or classpath and loop through its contents and grab stuff directly from the jar files. with webstart, the jars are going to be renamed and cached locally in some obscure directory like C:\Documents and Settings\user\Application Data\Sun\Java\Deployment\cache\javaws\http\Ddomain.com\P80\DMwebstart\DMapplication, and the classpath will point to something like C:\Program Files\Java\jre1.5.0_02\lib\deploy.jar

i have yet to figure out a method of grabbing a list of all the jar files in the application. i could probably live with grabbing the list of resources from the jnlp file (is there a method for this?), but this doesnt seem like an ideal solution.

thanks
greg
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

I'd create own class loader and access plug-in files directly from server. I have to add a similar functionality to my webstarted application, so please keep us informed what you finally did.


Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
Greg Fidster
Greenhorn

Joined: Dec 08, 2004
Posts: 10
I actually did something similar to that.
I merged all the various plug-ins into a single xml file and placed it on the server.

The downside is adds a global file to maintain rather than letting each plug-in manage its own plug-in.xml file. Works fine as an internal applications, but wouldn't fit into a plug-in model such as eclipse.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Searching for a resource
 
Similar Threads
simple search v/s classpath search
java.util.zip.ZipException: The system cannot find the path specified
Using Web Start
sending mail using velocity template
running Eclipse RCP application from JWS: jws starts, but closes immediatly