Jump to content
Excelsior Forums
Sign in to follow this  
Bluewolf

Runtime Loading And Resources

Recommended Posts

Hi,

I am having a problem with a runtime loaded dll. It is unable to find the image resources it requires.

If I link the the dll in staticly then everything works ok.

Is there something special that I need to do in the case of runtime loaded dll's?

Cheers

Share this post


Link to post
Share on other sites

The resources should be bound to the executable, not to DLL.

BTW, what do you mean by "runtime loaded dll's"? Do you use class-to-dll mapping or what?

Share this post


Link to post
Share on other sites

Hi Mavr

Thats exactly right, I am attempting to use the -dll:class-prefix*:dll-name syntax.

The class files are found but the resources bound to the dll are not.

This dll has no hard references in the main executable. (i.e new is not used on any of the classes). All access is though things like Class.forName( "..." ) etc.

Cheers

Share this post


Link to post
Share on other sites

Binding resources to such DLLs won't work (all bound resources are listed during the runtime initialization). As I said before, please bind all resources to the executable.

Share this post


Link to post
Share on other sites

Hi mavr,

I've just run into this problem again. We are trying to compile JDBC drivers into seperate dll's and loading them though the standard DriverManager interface. The choice of jdbc driver would be upto the users of our software. Compiling them all into the main exe is not really possible in this case, just due to the size of the resulting exe.

Are there any plans to change how resources are loaded in a future version of JET? Being able to load resources that are in a dll that is linked at runtime is something that would useful to us.

Share this post


Link to post
Share on other sites

Hello,

The problem with resources in dynamic DLLs can be solved in the following way.

The problem is that the Java classpath is queried and initialized during the application startup. So if DLL is loaded dynamically, its resource jars cannot be appended into the application classpath.

The solution is to manually redefine application classpath, including all resource jars from all possible dynamic DLLs.

To do it, open JetPackII, on page resources choose executable. In the "Java system properties" panel you can see the value of the java.class.path property, that is automatically calculated by JetPackII.

Click below the automatic java.class.path definition and redefine java.class.path by typing

  java.class.path=<type here an automatic value of the java.class.path>;<list all resource jars from all dynamic DLLs>

Note that classpath entries are separated by semicolon on Windows and by colon on Linux.

After you've defined java.class.path and re-packaged application, dynamic DLLs will be able to found their resources, as their jar files are listed in application classpath from the start of the application.

-AlexM

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×