Provide Dll path to System.loadLibrary on export?

You need to put the DLL in the same path that the application is running, in a system path or add its path the PATH variable before starting the app.

I am confused with your answer , can you rephrase it with an example please. – helloMaga Sep 29 '11 at 20:11.

The following snippet will load the DLL regardless of the working directory if it's loacted in the same directory as the JAR file: CodeSource codeSource = MainClass.class. GetProtectionDomain().getCodeSource(); File jarFile = new File(codeSource.getLocation().toURI().getPath()); File parentDir = jarFile.getParentFile(); File dllFile = new File(parentDir, "my. Dll"); System.

Load(dllFile.getPath()).

Thank you. What is MainClass here, and will your solution work if I just have the dll in project directory. – helloMaga Sep 29 '11 at 20:13 MainClass is the class name of the class that this snippet is placed in.

The DLL has to be in the same directory as the JAR file. If the relative location is different, just prepend it to "my. Dll", like "../my.

Dll" for the parent directory. – Ingo Kegel Sep 30 '11 at 7:58.

Have a look at Runtime.load. Loads the specified filename as a dynamic library. The filename argument must be a complete path name.

From java_g it will automagically insert "_g" before the ". So" (for example Runtime.getRuntime(). Load("/home/avh/lib/libX11.So");).

First, if there is a security manager, its checkLink method is called with the filename as its argument. This may result in a security exception. This is similar to the method loadLibrary(String), but it accepts a general file name as an argument rather than just a library name, allowing any file of native code to be loaded.

The method System. Load(String) is the conventional and convenient means of invoking this method.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions