Posted by
Robert Dougherty on
Sep 23, 2015; 7:39pm
URL: http://imagej.273.s1.nabble.com/Loading-native-DLLs-into-InageJ-tp5014423p5014429.html
Wilhelm,
Have a look at "Save As Movie" by Qingzong TSENG. It uses OpenCV and ffmpeg to save movies. Here is the experiment I just did on a Windows 64-bit system.
1. Install Save As Movie per the instructions. (McAfee warned me about opencv.x86_64.jar. Not sure what to think about that...)
2. Verify that it works: Plugins/Input-Ouput/Save as Move exists and somewhat functions. (There may be missing codec issues. .avi/H.264 worked for me.)
3. Delete SaveAsMovie_.jar. This removes the class file SaveMovie.class, which was in the folder ffmpegMovieIO in the .jar, as well as the plugins.config file that installed ffmpegIO.saveMovie on the menus.
4. Open the source, SaveMove.java from the "Save As Movie" web page, comment out the first line, "package ffmpegIO;", change the class name from SaveMove to SaveMovie_ , and save it in the plugins folder as SaveMove_.java
5. Try Compile and Run... SaveMovie_
6. Try it again. Nothing different seems to happen.
Of course, it would be best to leave the package structure and the menus as they were. I just wanted to show that Compile and Run can work this way.
Bob
On Sep 23, 2015, at 7:19 AM, Burger Wilhelm wrote:
> Hello all, I wonder if someone can help me with the following technical problem:
>
> I am loading a native DLL into ImageJ (e.g., for using OpenGL or OpenCV, under Windows). Everything works nicely if I execute precompiled plugins that use the native methods in that DLL, even repeatedly. However, when I execute the same plugin with "Compile and run" I get the following errors:
>
> java.lang.UnsatisfiedLinkError: Native Library XXX.dll already loaded in another classloader
>
> As a remedy I tried to load the DLL by a static block of a special class, placed in a separate JAR file (read somewhere that this might help), and referenced that class "by name" - but with no avail.
>
> I am not sure I understand well enough how class loaders and DLLs work together but assume somebody else must have encountered the same mess before. Any hints or suggestions for how to solve this?
>
> Thanks much,
> Wilhelm
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.htmlRobert Dougherty, Ph.D.
President, OptiNav, Inc.
1414 127th Place NE #106
Bellevue, WA 98005
Tel. (425)891-4883
FAX (425)467-1119
www.optinav.com
[hidden email]
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html