• Post Reply Bookmark Topic Watch Topic
  • New Topic

Dynamic Class + Resource Loading

 
Zak Nixon
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my previous post, I needed to be able to run the dynamic classloading example from Sun (link).
This works for classes, but does it work for other resources, such
as images, config files, etc. And if so, how does my classes reference such resources in code ?

Can someone explain to me if it works, and if so, how ?

Thanks,

Zak Nixon
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is, that example was very specifically aimed at class loading.

There are multiple ways to tackle this problem, though.

First, you could add remote methods to your server to return serialized versions of resources to the client. The server loads resources off disk at it's location, serializes them and sends them to the client, and the client now has a copy.

Another approach would be to change the example so the ClassServer didn't just serve classes, but knew how to serve other filetypes as well. Then you could request a resource from the ClassServer using HTTP.

Not appropriate to this example, since it seems to concentrate on having a very minimal client portion, but another approach would be to package the client code, and any other resources used by the client, into a JAR and provide that to the user.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!