Getting ClassNotFound Error

fiji
imagej
Tags: #<Tag:0x00007fd542b1b8f8> #<Tag:0x00007fd542b1b790>

#1

I am trying to make a imagej plugin, this project has a dependency of below exception jar, i havethis dependency in my project but after exporting to jar and installing plugin through fiji, it keeps giving me this error.

java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonGenerationException
	at Weka_Segmentation_.run(Weka_Segmentation_.java:81)
	at ij.IJ.runUserPlugIn(IJ.java:217)
	at ij.IJ.runPlugIn(IJ.java:181)
	at ij.Executer.runCommand(Executer.java:137)
	at ij.Executer.run(Executer.java:66)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.core.JsonGenerationException
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 6 more

#2

The dependency was not installed to your Fiji installation, i.e. you have your plugin jar, but not jackson-core.jar on your classpath.

The easiest way to install all required dependencies into your ImageJ installation is to build your plugin with maven:

mvn -Dimagej.app.directory=/path/to/your/Fiji.app

This will copy the plugin jar and all dependencies into your Fiji installation.


#3

So i put this in VMarguments but i am getting
Error: Could not find or load main class mvn
Do you have any other method like exporting a jar and install it through jar.


#4

As @imagejan suggested, you can compile the plugin directly using maven. If you are developing in an IDE, you can follow this minimal example.