Plugin only launches in Netbeans, not when built

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Plugin only launches in Netbeans, not when built

LukasHehn
Hi,

I wrote a MM plugin that works fine when I launch it in Netbeans but won't
load when I build it and copy the jar to the mmplugins folder. When
searching this mailing list, I only found a possible solution that I have
set the wrong java version in Netbeans, but that isn't the case.

I believe this is the relevant error in the log: 2018-03-29T11:31:48.343747
tid5796 [IFO,App] java.lang.NoClassDefFoundError: org/opencv/core/Mat
which I guess means that it is missing class definitions or libraries, but I
have no idea where to find those and more importantly where to put them to
make it work.

thanks,

Lukas Hehn




--
Sent from: http://micro-manager.3463995.n2.nabble.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Plugin only launches in Netbeans, not when built

Kyle Douglass
Hi Lukas,

On 03/29/2018 11:33 AM, LukasHehn wrote:
>
> I believe this is the relevant error in the log: 2018-03-29T11:31:48.343747
> tid5796 [IFO,App] java.lang.NoClassDefFoundError: org/opencv/core/Mat
> which I guess means that it is missing class definitions or libraries, but I
> have no idea where to find those and more importantly where to put them to
> make it work.
>

Have you tried this? (I'm using Netbeans 8.2.)

1. Right click on your project in the "Projects" window.

2. Select "Properties" in the context menu that appears.

3. Select "Build" > "Packaging" under the "Categories" side pane.

4. Check the box that says "Copy Dependent Libraries."

5. Recompile the plugin.


This is just a guess. By the way, you can open your .jar file with a
.zip archive explorer and check to see whether your classes are in there
or not.

I hope this helps,

Kyle

--
Kyle M. Douglass, PhD
Post-doctoral researcher
The Laboratory of Experimental Biophysics
EPFL, Lausanne, Switzerland
http://kmdouglass.github.io
http://leb.epfl.ch


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Plugin only launches in Netbeans, not when built

LukasHehn
Hi Kyle,

Thanks for the response, i have tried "Copy Dependent Libraries.", but I'm
still stuck. This gives me a Lib folder as well as my .jar file, but I don't
know what to do with that folder either. It does not help to just put it
into the MMPlugins folder with the .jar.

Does anyone else know how to fix this problem? I really don't want to have
to open netbeans every time I want to use MM.

thanks,

Lukas



--
Sent from: http://micro-manager.3463995.n2.nabble.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Plugin only launches in Netbeans, not when built

Nico Stuurman-2
In reply to this post by LukasHehn
HI Lukas,

On 3/29/18 2:33 AM, LukasHehn wrote:

> I wrote a MM plugin that works fine when I launch it in Netbeans but won't
> load when I build it and copy the jar to the mmplugins folder. When
> searching this mailing list, I only found a possible solution that I have
> set the wrong java version in Netbeans, but that isn't the case.
>
> I believe this is the relevant error in the log: 2018-03-29T11:31:48.343747
> tid5796 [IFO,App] java.lang.NoClassDefFoundError: org/opencv/core/Mat
> which I guess means that it is missing class definitions or libraries, but I
> have no idea where to find those and more importantly where to put them to
> make it work.

It looks like your code depends on an opencv Java wrapper (something
like opencv.jar).   You must have it in your Netbeans project, or it
could not run there.  Try copying opencv.jar to the ImageJ plugin
directory (or to plugins/Micro-Manager).  You may also need to copy the
native .dll or .so, most likely to the Micro-Manager directory.

Best,

Nico



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Plugin only launches in Netbeans, not when built

LukasHehn
 
Nico Stuurman-2 wrote
> HI Lukas,
>
> It looks like your code depends on an opencv Java wrapper (something
> like opencv.jar).   You must have it in your Netbeans project, or it
> could not run there.  Try copying opencv.jar to the ImageJ plugin
> directory (or to plugins/Micro-Manager).  You may also need to copy the
> native .dll or .so, most likely to the Micro-Manager directory.


Thank you, it turns out it was a combination of both answers that solved it,
because it wasn't just the opencv jar that was missing. So in case someone
else has this problem, just copy every file from the lib folder that
netbeans creates when you check "copy dependent libraries" into the
plugins/micro-manager folder. (You can skip the files that are already in
there of course)

Best,

Lukas



--
Sent from: http://micro-manager.3463995.n2.nabble.com/

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general