Issue
I have following problem that have been reported several times (link1, link2, link3, link4, link5, etc). But I could not find a clear answer.
I just edited the name of project and basic information in the template of this project example-imagej-command;
when I try to build with Maven in eclipse;
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/cosacak/.p2/pool/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.16.0.20200610-1735/jars/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [file:/C:/Users/cosacak/eclipse/java-2020-12/eclipse/configuration/org.eclipse.osgi/5/0/.cp/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/cosacak/.p2/pool/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.16.0.20200610-1735/jars/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [file:/C:/Users/cosacak/eclipse/java-2020-12/eclipse/configuration/org.eclipse.osgi/5/0/.cp/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< de.kizillab.org:MyExamplePlugin >-------------------
[INFO] Building My Example Plugin 1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-rules) @ MyExamplePlugin ---
[INFO] Adding ignore: module-info
[INFO] Adding ignore: META-INF/versions/*/module-info
[INFO] Adding ignore: org.apache.hadoop.yarn.*.package-info
[INFO] Adding ignore: org.apache.spark.unused.UnusedStubClass
[INFO] Adding ignore: org.hibernate.stat.ConcurrentStatisticsImpl
[INFO] Adding ignore: org.junit.runner.Runner
[INFO] Adding ignore: module-info
[WARNING] Rule 2: org.apache.maven.plugins.enforcer.RequireJavaVersion failed with message:
Detected JDK Version: 15.0.2 is not in the allowed range [1.8.0-101,1.8.9999].
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.330 s
[INFO] Finished at: 2021-03-31T02:49:00+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce (enforce-rules) on project MyExamplePlugin: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Now if I run as Java Application using eclipse;
log4j:WARN No appenders could be found for logger (org.bushe.swing.event.EventService).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
[ERROR] Cannot create plugin: class='org.scijava.plugins.scripting.javascript.JavaScriptScriptLanguage', name='JavaScript', priority=0.0, enabled=true, pluginType=ScriptLanguage
java.lang.IllegalArgumentException: No such script engine: javascript
at org.scijava.script.AdaptedScriptLanguage.findFactory(AdaptedScriptLanguage.java:152)
at org.scijava.script.AdaptedScriptLanguage.<init>(AdaptedScriptLanguage.java:74)
at org.scijava.plugins.scripting.javascript.JavaScriptScriptLanguage.<init>(JavaScriptScriptLanguage.java:59)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:350)
at java.base/java.lang.Class.newInstance(Class.java:645)
at org.scijava.plugin.PluginInfo.createInstance(PluginInfo.java:306)
at org.scijava.plugin.DefaultPluginService.createInstance(DefaultPluginService.java:237)
at org.scijava.plugin.DefaultPluginService.createInstances(DefaultPluginService.java:226)
at org.scijava.plugin.DefaultPluginService.createInstancesOfType(DefaultPluginService.java:217)
at org.scijava.plugin.AbstractSingletonService.initInstances(AbstractSingletonService.java:138)
at org.scijava.plugin.AbstractSingletonService.getInstances(AbstractSingletonService.java:77)
at org.scijava.plugin.SingletonService.lambda$initialize$0(SingletonService.java:97)
at org.scijava.object.ObjectIndex.resolvePending(ObjectIndex.java:388)
at org.scijava.object.ObjectIndex.get(ObjectIndex.java:133)
at org.scijava.object.DefaultObjectService.getObjects(DefaultObjectService.java:87)
at org.scijava.display.DefaultDisplayService.getDisplays(DefaultDisplayService.java:166)
at org.scijava.ui.DefaultUIService.showUI(DefaultUIService.java:159)
at org.scijava.ui.DefaultUIService.showUI(DefaultUIService.java:142)
at de.kizillab.org.MyExamplePlugin.main(MyExamplePlugin.java:85)
[ERROR]: Cannot locate JRE jar in C:\Users\cosacak\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_15.0.2.v20210201-0955\jre
[ERROR] Cannot create plugin: class='org.scijava.ui.swing.script.languagesupport.JavaLanguageSupportPlugin', priority=0.0, enabled=true, pluginType=LanguageSupportPlugin
java.lang.IllegalArgumentException: info cannot be null
at org.fife.rsta.ac.java.JarManager.addClassFileSource(JarManager.java:157)
at org.fife.rsta.ac.java.JarManager.addCurrentJreClassFileSource(JarManager.java:193)
at org.scijava.ui.swing.script.languagesupport.JavaLanguageSupportPlugin.<init>(JavaLanguageSupportPlugin.java:56)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:350)
at java.base/java.lang.Class.newInstance(Class.java:645)
at org.scijava.plugin.PluginInfo.createInstance(PluginInfo.java:306)
at org.scijava.plugin.DefaultPluginService.createInstance(DefaultPluginService.java:237)
at org.scijava.plugin.DefaultPluginService.createInstances(DefaultPluginService.java:226)
at org.scijava.plugin.DefaultPluginService.createInstancesOfType(DefaultPluginService.java:217)
at org.scijava.plugin.AbstractSingletonService.initInstances(AbstractSingletonService.java:138)
at org.scijava.plugin.AbstractSingletonService.getInstances(AbstractSingletonService.java:77)
at org.scijava.plugin.SingletonService.lambda$initialize$0(SingletonService.java:97)
at org.scijava.object.ObjectIndex.resolvePending(ObjectIndex.java:388)
at org.scijava.object.ObjectIndex.get(ObjectIndex.java:133)
at org.scijava.object.DefaultObjectService.getObjects(DefaultObjectService.java:87)
at org.scijava.display.DefaultDisplayService.getDisplays(DefaultDisplayService.java:166)
at org.scijava.ui.DefaultUIService.showUI(DefaultUIService.java:159)
at org.scijava.ui.DefaultUIService.showUI(DefaultUIService.java:142)
at de.kizillab.org.MyExamplePlugin.main(MyExamplePlugin.java:85)
[INFO] Found 10 JHotDraw adapters.
Solution
For window users, if you have Maven project, Maven is also available and can be used to compile/package as can be done on Linux (see my answer above). As a result, in case one has the problem above while building a project in eclipse and does not have Linux as well, can use Maven on windows as well.
Now I am writing my scripts/projects in eclipse and using Maven command to compile/package as below;
Download Maven zip file from here and unzip it anywhere on windows, does not have to be in your project folder. Add maven \bin
in PATH. The bin file has maven.cmd
in e.g., apache-maven-3.6.3-bin\apache-maven-3.6.3\bin
folder after unzipping.
now open command terminal in windows, use cd
to navigate to the project folder which have pom.xml
file as well. In my case;
cd Documents\eclipse-workspace\example-imagej-command-master
mvn compile
mvn package
it works as well on windows.
Answered By - m.i.cosacak