<div dir="ltr"><div>Hi Michael,</div><div><br></div><div>> gives me a self contained runnable jar. Progress! I’m learning.</div><div>> </div><div>> BUT as before when I run the jar, I get the Exception: No compatible</div><div>> service: org.scijava.service.SciJavaService</div><div><br></div><div>Self contained runnable JARs (i.e., uber-jars) are convenient in some ways, but come with a host of problems.</div><div><br></div><div>1) If you do not shade your dependencies (i.e., rename their packages), then you may ship duplicate and/or incompatible classes with other libraries. This makes your library much harder to reuse in a shared system such as an ImageJ installation.</div><div><br></div><div>2) You cannot ship piecemeal updates to individual dependencies -- i.e., every time your code changes, you must ship a new (possibly very large) new JAR file to your users.</div><div><br></div><div>3) The SciJava annotation processor, responsible for indexing the @Plugin annotations that drive SciJava/ImageJ2/etc. plugins, writes the metadata into a resource file at META-INF/json/org.scijava.plugin.Plugin within the JAR. If you try to create an uber-jar via the assembly or shade plugin, the default combination algorithm will overwrite those files, stomping the annotations.</div><div><br></div><div>We wrote some code which offers one way around this:</div><div> <a href="https://github.com/imagej/imagej/blob/imagej-2.0.0-rc-17/pom.xml#L614-L631">https://github.com/imagej/imagej/blob/imagej-2.0.0-rc-17/pom.xml#L614-L631</a></div><div><br></div><div>For more on uber-jars, see also:</div><div> <a href="http://imagej.net/Frequently_Asked_Questions#How_can_I_call_ImageJ_from_my_software.3F">http://imagej.net/Frequently_Asked_Questions#How_can_I_call_ImageJ_from_my_software.3F</a></div><div><br></div><div>The gist is: avoid using an uber-jar unless you really need it.</div><div><br></div><div>> <span style="font-size:13px">I’ve got it working with your help!</span></div><div><span style="font-size:13px"><br></span></div><div><span style="font-size:13px">Awesome, congratulations. Let us know if you encounter any more roadblocks.</span></div><div><span style="font-size:13px"><br></span></div><div>Regards,</div><div>Curtis</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 5, 2014 at 12:03 PM, Michael Ellis <span dir="ltr"><<a href="mailto:michael.ellis@dsuk.biz" target="_blank">michael.ellis@dsuk.biz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Adding a build section to the POM:<div><br></div><div><div> <build></div><div> <plugins></div><div> <plugin></div><div> <groupId>org.apache.maven.plugins</groupId></div><div> <artifactId>maven-shade-plugin</artifactId></div><div> <version>2.3</version></div><div> <executions></div><div> <execution></div><div> <phase>package</phase></div><div> <goals></div><div> <goal>shade</goal></div><div> </goals></div><div> <configuration></div><div> <transformers></div><div> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"></div><div> <manifestEntries></div><div> <Main-Class>com.mycompany.app.App</Main-Class></div><div> <Build-Number>123</Build-Number></div><div> </manifestEntries></div><div> </transformer></div><div> </transformers></div><div> </configuration></div><div> </execution></div><div> </executions></div><div> </plugin></div><div> </plugins></div><div> </build></div><div><br></div><div>To the POM gives me a self contained runnable jar. Progress! I’m learning.</div><div><br></div><div>BUT as before when I run the jar, I get the Exception: No compatible service: org.scijava.service.SciJavaService</div><div>=================================================================</div><div><br></div><div><div style="margin:0px;font-size:10px;font-family:Monaco"><div style="margin:0px">[Michaels-Retina:~/temp/deleteme/my-app] michaelellis% java -jar target/my-app-1.0-SNAPSHOT.jar </div><div style="margin:0px">Hello World!</div><div style="margin:0px">Exception: No compatible service: org.scijava.service.SciJavaService</div><div><div style="font-family:Helvetica;font-size:12px">=================================================================</div></div><div style="font-family:Helvetica;font-size:12px"><br></div><div style="font-family:Helvetica;font-size:12px">Still vexed!</div><div style="font-family:Helvetica;font-size:12px"><br></div><div><br></div></div></div></div><div><div class="h5"><div><div>On 5 Dec 2014, at 17:17, Curtis Rueden <<a href="mailto:ctrueden@wisc.edu" target="_blank">ctrueden@wisc.edu</a>> wrote:</div><br><blockquote type="cite"><div dir="ltr">Hi Michael,<div><br></div><div>> <span style="font-size:13px">mvn claims to build everything OK</span></div><div><span style="font-size:13px"><br></span></div><div><span style="font-size:13px">Yep, it did build successfully.</span></div><div><span style="font-size:13px"><br></span></div><div><div><div>> % java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App</div><div>> Error: A JNI error has occurred, please check your installation and try again</div><div>> Exception in thread "main" java.lang.NoClassDefFoundError: io/scif/SCIFIO</div><div><br></div></div><div style="font-size:13px">Maven is primarily a build tool. It puts the correct JARs on your classpath at compile time. In your case, that is scifio-0.17.1.jar and its dependencies.</div></div><div style="font-size:13px"><br></div><div style="font-size:13px">However, the way you are launching your program is not putting the required dependencies on the classpath. You put only my-app-1.0-SNAPSHOT.jar on the classpath, and its dependencies are missing. So of course Java cannot find the needed classes.</div><div style="font-size:13px"><br></div><div style="font-size:13px"><div>The gist is: it is your responsibility to assemble the dependencies and ensure they are on the classpath somehow when you launch your application.</div><div><br></div>There are several ways to accomplish this. Here is one generally useful way using Maven, which does not assume you are doing anything ImageJ-related:</div><div style="font-size:13px"><br></div><div style="font-size:13px"> $ mvn dependency:copy-dependencies</div><div style="font-size:13px"> $ java -cp 'target/my-app-1.0-SNAPSHOT.jar:target/dependency/*' com.mycompany.app.App</div><div style="font-size:13px"><br></div><div style="font-size:13px">The "copy-dependencies" goal copies all the JAR files needed by your program into the target/dependency folder, for easy subsequent consumption.</div><div style="font-size:13px"><br></div><div style="font-size:13px">Alternately, the "ImageJ way" of dealing with deployment is to ship all needed dependencies in the "jars" folder of your ImageJ application. We created a Maven goal for this too, which you can use as follows:</div><div style="font-size:13px"><br></div><div style="font-size:13px"> $ mvn -Dimagej.app.directory=/Applications/ImageJ.app -Ddelete.other.versions=true</div><div style="font-size:13px"><br></div><div style="font-size:13px">Which will copy your JAR and its dependencies into your ImageJ installation at /Applications/ImageJ.app. But note that in order for this goal to work, you must extend the pom-imagej parent (see <a href="https://github.com/imagej/minimal-ij1-plugin" target="_blank">https://github.com/imagej/minimal-ij1-plugin</a> for an example).</div><div style="font-size:13px"><br></div><div style="font-size:13px">A third solution is to use the exec-maven-plugin to launch your application directly using Maven. E.g.: <a href="https://github.com/imagej/imagej/blob/imagej-2.0.0-rc-17/pom.xml#L255-L278" target="_blank">https://github.com/imagej/imagej/blob/imagej-2.0.0-rc-17/pom.xml#L255-L278</a></div><div style="font-size:13px"><br></div><div style="font-size:13px">Regards,<br></div><div style="font-size:13px">Curtis</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 5, 2014 at 11:03 AM, Michael Ellis <span dir="ltr"><<a href="mailto:michael.ellis@dsuk.biz" target="_blank">michael.ellis@dsuk.biz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Curtis,<div><br></div><div>Thanks but it is still not working.</div><div><br></div><div>I have cut out using NetBeans and am now just using the CLI and a text editor. </div><div><br></div><div>POM as follows:</div><div><br></div><div>========================================================</div><div><div><project xmlns="<a href="http://maven.apache.org/POM/4.0.0" target="_blank">http://maven.apache.org/POM/4.0.0</a>" xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a>"</div><div> xsi:schemaLocation="<a href="http://maven.apache.org/POM/4.0.0" target="_blank">http://maven.apache.org/POM/4.0.0</a> <a href="http://maven.apache.org/xsd/maven-4.0.0.xsd" target="_blank">http://maven.apache.org/xsd/maven-4.0.0.xsd</a>"></div><div> <modelVersion>4.0.0</modelVersion></div><div><br></div><div> <groupId>com.mycompany.app</groupId></div><div> <artifactId>my-app</artifactId></div><div> <version>1.0-SNAPSHOT</version></div><div> <packaging>jar</packaging></div><div><br></div><div> <name>my-app</name></div><div> <url><a>http://maven.apache.org</url></a></div><div><br></div><div> <properties></div><div> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></div><div> </properties></div><span><div> </div><div><span style="white-space:pre-wrap"> </span><repositories></div><div><span style="white-space:pre-wrap"> </span><repository></div><div><span style="white-space:pre-wrap"> </span><id>imagej.public</id></div><div><span style="white-space:pre-wrap"> </span><url><a href="http://maven.imagej.net/content/groups/public%3C/url%3E" target="_blank">http://maven.imagej.net/content/groups/public</url></a></div><div><span style="white-space:pre-wrap"> </span></repository></div><div><span style="white-space:pre-wrap"> </span></repositories></div><div><br></div></span><div> <dependencies></div><div> <dependency></div><div> <groupId>junit</groupId></div><div> <artifactId>junit</artifactId></div><div> <version>3.8.1</version></div><div> <scope>test</scope></div><span><div> </dependency></div><div> </div><div><span style="white-space:pre-wrap"> </span><dependency></div><div><span style="white-space:pre-wrap"> </span> <groupId>io.scif</groupId></div><div><span style="white-space:pre-wrap"> </span> <artifactId>scifio</artifactId></div><div><span style="white-space:pre-wrap"> </span> <version>0.17.1</version></div></span><div><span style="white-space:pre-wrap"> </span></dependency></div><div> </div><div> </dependencies></div><div></project></div></div><div>========================================================</div><div><br></div><div>File hierarchy:</div><div><br></div><div><div style="margin:0px;font-size:10px;font-family:Monaco">.</div><div style="margin:0px;font-size:10px;font-family:Monaco">./.DS_Store</div><div style="margin:0px;font-size:10px;font-family:Monaco">./pom.xml</div><div style="margin:0px;font-size:10px;font-family:Monaco">./src</div><div style="margin:0px;font-size:10px;font-family:Monaco">./src/main</div><div style="margin:0px;font-size:10px;font-family:Monaco">./src/main/java</div><div style="margin:0px;font-size:10px;font-family:Monaco">./src/main/java/com</div><div style="margin:0px;font-size:10px;font-family:Monaco">./src/main/java/com/mycompany</div><div style="margin:0px;font-size:10px;font-family:Monaco">./src/main/java/com/mycompany/app</div><div style="margin:0px;font-size:10px;font-family:Monaco">./src/main/java/com/mycompany/app/App.java</div><div style="margin:0px;font-size:10px;font-family:Monaco">./src/test</div><div style="margin:0px;font-size:10px;font-family:Monaco">./src/test/java</div><div style="margin:0px;font-size:10px;font-family:Monaco">./src/test/java/com</div><div style="margin:0px;font-size:10px;font-family:Monaco">./src/test/java/com/mycompany</div><div style="margin:0px;font-size:10px;font-family:Monaco">./src/test/java/com/mycompany/app</div><div style="margin:0px;font-size:10px;font-family:Monaco">./src/test/java/com/mycompany/app/AppTest.java</div></div><div>========================================================</div><div><br></div><div>App.java as follows:</div><div><br></div><div><div>package com.mycompany.app;</div><div><br></div><div>import io.scif.FormatException;</div><div>import io.scif.ImageMetadata;</div><div>import io.scif.Plane;</div><div>import io.scif.Reader;</div><div>import io.scif.SCIFIO;</div><div><br></div><div>public class App </div><div>{</div><div> public static void main( String[] args )</div><div> {</div><div><span style="white-space:pre-wrap"> </span>try {</div><div> <span style="white-space:pre-wrap"> </span> System.out.println( "Hello World!" );</div><span><span style="white-space:pre-wrap"> </span>SCIFIO scifio = new SCIFIO();</span><div><span style="white-space:pre-wrap"> </span>String sampleImage</div><div><span style="white-space:pre-wrap"> </span>= "8bit-signed&pixelType=int8&lengths=50,50,3,5,7&axes=X,Y,Z,Channel,Time.fake";</div><div><span style="white-space:pre-wrap"> </span>final Reader reader = scifio.initializer().initializeReader(sampleImage);</div><div><span style="white-space:pre-wrap"> </span>System.out.printf("reader=%s%n", reader );</div><div> } catch (Exception e) {</div><div><span style="white-space:pre-wrap"> </span> System.out.printf("Exception: %s%n", e.getMessage() );</div><div> }</div><div> }</div><div>}</div></div><div><br></div><div>========================================================</div><div><br></div><div>mvm -U install</div><div><br></div><div><div style="margin:0px;font-size:10px;font-family:Monaco">[Michaels-Retina:~/temp/deleteme/my-app] michaelellis% mvn -U install</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] Scanning for projects...</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] </div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] ------------------------------------------------------------------------</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] Building my-app 1.0-SNAPSHOT</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] ------------------------------------------------------------------------</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] </div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ my-app ---</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] Using 'UTF-8' encoding to copy filtered resources.</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] skip non existing resourceDirectory /Users/michaelellis/temp/deleteme/my-app/src/main/resources</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] </div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ my-app ---</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] Changes detected - recompiling the module!</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] Compiling 1 source file to /Users/michaelellis/temp/deleteme/my-app/target/classes</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] </div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ my-app ---</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] Using 'UTF-8' encoding to copy filtered resources.</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] skip non existing resourceDirectory /Users/michaelellis/temp/deleteme/my-app/src/test/resources</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] </div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ my-app ---</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] Changes detected - recompiling the module!</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] Compiling 1 source file to /Users/michaelellis/temp/deleteme/my-app/target/test-classes</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] </div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ my-app ---</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] Surefire report directory: /Users/michaelellis/temp/deleteme/my-app/target/surefire-reports</div><div style="margin:0px;font-size:10px;font-family:Monaco;min-height:14px"><br></div><div style="margin:0px;font-size:10px;font-family:Monaco">-------------------------------------------------------</div><div style="margin:0px;font-size:10px;font-family:Monaco"> T E S T S</div><div style="margin:0px;font-size:10px;font-family:Monaco">-------------------------------------------------------</div><div style="margin:0px;font-size:10px;font-family:Monaco">Running com.mycompany.app.AppTest</div><div style="margin:0px;font-size:10px;font-family:Monaco">Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.005 sec</div><div style="margin:0px;font-size:10px;font-family:Monaco;min-height:14px"><br></div><div style="margin:0px;font-size:10px;font-family:Monaco">Results :</div><div style="margin:0px;font-size:10px;font-family:Monaco;min-height:14px"><br></div><div style="margin:0px;font-size:10px;font-family:Monaco">Tests run: 1, Failures: 0, Errors: 0, Skipped: 0</div><div style="margin:0px;font-size:10px;font-family:Monaco;min-height:14px"><br></div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] </div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ my-app ---</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] Building jar: /Users/michaelellis/temp/deleteme/my-app/target/my-app-1.0-SNAPSHOT.jar</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] </div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] --- maven-install-plugin:2.4:install (default-install) @ my-app ---</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] Installing /Users/michaelellis/temp/deleteme/my-app/target/my-app-1.0-SNAPSHOT.jar to /Users/michaelellis/.m2/repository/com/mycompany/app/my-app/1.0-SNAPSHOT/my-app-1.0-SNAPSHOT.jar</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] Installing /Users/michaelellis/temp/deleteme/my-app/pom.xml to /Users/michaelellis/.m2/repository/com/mycompany/app/my-app/1.0-SNAPSHOT/my-app-1.0-SNAPSHOT.pom</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] ------------------------------------------------------------------------</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] BUILD SUCCESS</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] ------------------------------------------------------------------------</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] Total time: 1.962 s</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] Finished at: 2014-12-05T16:59:50+00:00</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] Final Memory: 18M/242M</div><div style="margin:0px;font-size:10px;font-family:Monaco">[INFO] ————————————————————————————————————</div></div><div style="margin:0px;font-size:10px;font-family:Monaco"><br></div><div style="margin:0px;font-size:10px;font-family:Monaco"><div style="font-family:Helvetica;font-size:12px">========================================================</div><div><br></div></div><div>mvn claims to build everything OK there seems to be no inclusion of any scif libraries or class files.</div><div><br></div><div><br></div><div>When I run it I get:</div><div><br></div><div><div style="margin:0px;font-size:10px;font-family:Monaco">[Michaels-Retina:~/temp/deleteme/my-app] michaelellis% java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App</div><div style="margin:0px;font-size:10px;font-family:Monaco">Error: A JNI error has occurred, please check your installation and try again</div><div style="margin:0px;font-size:10px;font-family:Monaco">Exception in thread "main" java.lang.NoClassDefFoundError: io/scif/SCIFIO</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at java.lang.Class.getDeclaredMethods0(Native Method)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at java.lang.Class.privateGetDeclaredMethods(Class.java:2699)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at java.lang.Class.privateGetMethodRecursive(Class.java:3046)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at java.lang.Class.getMethod0(Class.java:3016)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at java.lang.Class.getMethod(Class.java:1782)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)</div><div style="margin:0px;font-size:10px;font-family:Monaco">Caused by: java.lang.ClassNotFoundException: io.scif.SCIFIO</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at java.net.URLClassLoader.findClass(URLClassLoader.java:381)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at java.lang.ClassLoader.loadClass(ClassLoader.java:424)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at java.lang.ClassLoader.loadClass(ClassLoader.java:357)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>... 7 more</div></div><div><br></div><div><br></div><div>========================================================</div><div><br></div><div>I’ve been banging my head against this for two days now. </div><div><br></div><div>So any help appreciated</div><div><div><div><br></div><div><br><div><div>On 5 Dec 2014, at 16:35, Curtis Rueden <<a href="mailto:ctrueden@WISC.EDU" target="_blank">ctrueden@WISC.EDU</a>> wrote:</div><br><blockquote type="cite"><div dir="ltr">Hi Michael,<div><br></div><div><div>> The POM for io.scif:scifio:jar:0.17.1 is missing, no dependency</div><div>> information available</div></div><div><br></div><div>Make sure you have the following <repositories> block in your POM:</div><div><br></div><div><div><span style="white-space:pre-wrap"> </span><repositories></div><div><span style="white-space:pre-wrap"> </span><repository></div><div><span style="white-space:pre-wrap"> </span><id>imagej.public</id></div><div><span style="white-space:pre-wrap"> </span><url><a href="http://maven.imagej.net/content/groups/public" target="_blank">http://maven.imagej.net/content/groups/public</a></url></div><div><span style="white-space:pre-wrap"> </span></repository></div><div><span style="white-space:pre-wrap"> </span></repositories></div></div><div><br></div><div>Then rebuild with the "-U" flag. I don't know how to do this from NetBeans, but you only need to do it once from the CLI -- then you can return to NetBeans and it should work.</div><div><br></div><div>Regards,</div><div>Curtis</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 5, 2014 at 6:07 AM, Michael Ellis <span dir="ltr"><<a href="mailto:michael.ellis@dsuk.biz" target="_blank">michael.ellis@dsuk.biz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">I have followed the advice offered by Curtis regarding adding the io.scif: scifio dependency to my POM<div><br></div><div>The dependency part of my POM looks like this:</div><div><br></div><div><div> <dependencies></div><div> <dependency></div><div> <groupId>net.imglib2</groupId></div><div> <artifactId>imglib2</artifactId></div><div> <version>2.2.1-SNAPSHOT</version></div><div> <type>jar</type></div><div> </dependency></div><span><div> <dependency></div><div> <groupId>io.scif</groupId></div><div> <artifactId>scifio</artifactId></div><div> <version>0.17.1</version></div></span><div> <type>jar</type></div><div> </dependency></div><div> </dependencies></div></div><div><br></div><div>I am using NetBeans IDE, configured for use with maven project (I am slo using Java 8 and JavaFX)</div><div><br></div><div>However when I attempt to Build (or Build with Dependencies) within NetBeans, I get the following error message:</div><div>============================================================</div><div><br></div><div><div>cd /Users/michaelellis/Documents/Development/MavenImgLib2FX; JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home "/Applications/NetBeans/NetBeans 8.0.app/Contents/Resources/NetBeans/java/maven/bin/mvn" install</div><div>Scanning for projects...</div><div> </div><div>------------------------------------------------------------------------</div><div>Building MavenImgLib2FX 1.0-SNAPSHOT</div><div>------------------------------------------------------------------------</div><div>The POM for io.scif:scifio:jar:0.17.1 is missing, no dependency information available</div><div>------------------------------------------------------------------------</div><div>BUILD FAILURE</div><div>------------------------------------------------------------------------</div><div>Total time: 0.341s</div><div>Finished at: Fri Dec 05 10:34:41 GMT 2014</div><div>Final Memory: 7M/245M</div><div>------------------------------------------------------------------------</div><div>Failed to execute goal on project MavenImgLib2FX: Could not resolve dependencies for project biz.dsuk:MavenImgLib2FX:jar:1.0-SNAPSHOT: Failure to find io.scif:scifio:jar:0.17.1 in <a href="http://repo.maven.apache.org/maven2" target="_blank">http://repo.maven.apache.org/maven2</a> was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]</div><div><br></div><div>To see the full stack trace of the errors, re-run Maven with the -e switch.</div><div>Re-run Maven using the -X switch to enable full debug logging.</div><div><br></div><div>For more information about the errors and possible solutions, please read the following articles:</div><div>[Help 1] <a href="http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException" target="_blank">http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException</a></div><div><br></div><div>============================================================</div><div><br></div><div>If I open a terminal window and cd into the project directory and:</div><div><br></div><div><span style="white-space:pre-wrap"> </span>mvn clean package</div><div><br></div><div>It succeeds.</div><div><br></div><div>However, when I then attempt to run the project with:</div><div><br></div><div><span style="white-space:pre-wrap"> </span><span style="font-family:Monaco;font-size:10px">java -cp MavenImgLib2FX-1.0-SNAPSHOT.jar biz.dsuk.mavenimglib2fx.MainApp</span></div><div><span style="font-family:Monaco;font-size:10px"><br></span></div><div><span style="font-family:Monaco;font-size:10px">The application starts to execute but throws </span><font face="Monaco" size="1">“No compatible service: io.scif.SCIFIOService” exception.</font></div><div>============================================================</div><div><br></div><div><div style="margin:0px;font-size:10px;font-family:Monaco">img1=CellImg [20x30]</div><div style="margin:0px;font-size:10px;font-family:Monaco">BufferedImage=BufferedImage@3137c585: type = 10 ColorModel: #pixelBits = 8 numComponents = 1 color space = java.awt.color.ICC_ColorSpace@134d9d5f transparency = 1 has alpha = false isAlphaPre = false ByteInterleavedRaster: width = 707 height = 699 #numDataElements 1 dataOff[0] = 0</div><div style="margin:0px;font-size:10px;font-family:Monaco">Loading image...</div><div style="margin:0px;font-size:10px;font-family:Monaco">Exception in Application start method</div><div style="margin:0px;font-size:10px;font-family:Monaco">java.lang.reflect.InvocationTargetException</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at java.lang.reflect.Method.invoke(Method.java:497)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:363)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:303)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at java.lang.reflect.Method.invoke(Method.java:497)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)</div><div style="margin:0px;font-size:10px;font-family:Monaco">Caused by: java.lang.RuntimeException: Exception in Application start method</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:875)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$150(LauncherImpl.java:157)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at com.sun.javafx.application.LauncherImpl$$Lambda$50/553264065.run(Unknown Source)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at java.lang.Thread.run(Thread.java:745)</div><div style="margin:0px;font-size:10px;font-family:Monaco">Caused by: java.lang.IllegalArgumentException: No compatible service: io.scif.SCIFIOService</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:243)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:194)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at org.scijava.service.ServiceHelper.loadServices(ServiceHelper.java:170)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at org.scijava.Context.<init>(Context.java:244)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at org.scijava.Context.<init>(Context.java:203)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at org.scijava.Context.<init>(Context.java:142)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at org.scijava.Context.<init>(Context.java:128)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at io.scif.SCIFIO.<init>(SCIFIO.java:81)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at biz.dsuk.mavenimglib2fx.MainApp.start(MainApp.java:38)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$156(LauncherImpl.java:821)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at com.sun.javafx.application.LauncherImpl$$Lambda$53/681110827.run(Unknown Source)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$169(PlatformImpl.java:326)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at com.sun.javafx.application.PlatformImpl$$Lambda$47/693632176.run(Unknown Source)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at com.sun.javafx.application.PlatformImpl.lambda$null$167(PlatformImpl.java:295)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at com.sun.javafx.application.PlatformImpl$$Lambda$49/1260282780.run(Unknown Source)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at java.security.AccessController.doPrivileged(Native Method)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at com.sun.javafx.application.PlatformImpl.lambda$runLater$168(PlatformImpl.java:294)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at com.sun.javafx.application.PlatformImpl$$Lambda$48/1364335809.run(Unknown Source)</div><div style="margin:0px;font-size:10px;font-family:Monaco"><span style="white-space:pre-wrap"> </span>at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)</div><div style="margin:0px;font-size:10px;font-family:Monaco">Exception running application biz.dsuk.mavenimglib2fx.MainApp</div></div><div>============================================================</div><div><br></div><div>If I remove the calls to the SCIO code and build and run from the command line, all works well.</div><div><br></div><div>The SCIO source code that I am using is lifted/amended from one of the tutorials and is as follows:</div><div><br></div><div><div>============================================================</div><div> imagePath = "8bit-signed&pixelType=int8&lengths=50,50,3,5,7&axes=X,Y,Z,Channel,Time.fake";</div><div> System.out.println("Loading image... '" + imagePath + "'");</div><div> SCIFIO scifio = new SCIFIO();</div><div> final Reader reader = scifio.initializer().initializeReader(imagePath);</div><div>============================================================</div></div><div><br></div><div>This source code works file in the SCIFIO tutorial.</div><div><br></div><div>Any help gratefully appreciated!!!!!</div><span><font color="#888888"><div><br></div><div>— Michael Ellis</div></font></span><div><div><br></div><div><br></div><div><br></div><div><br></div><div><div>On 3 Dec 2014, at 19:31, Curtis Rueden <<a href="mailto:ctrueden@WISC.EDU" target="_blank">ctrueden@WISC.EDU</a>> wrote:</div><br><blockquote type="cite"><div dir="ltr">Hi Michael,<div><br></div><div>> <span style="font-family:arial,sans-serif;font-size:13px">How do I establish what Maven projects I need to include? </span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">One way to check is using the dependency-maven-plugin like so:</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px"> mvn dependency:analyze</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">This will tell you:</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">A) Dependencies you declared but do not actually use; and</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">B) Dependencies you did not declare directly, but actually need.</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Note that this will only work if your project compiles successfully. In other words, it is easier to start with "too many" dependencies and pare down, rather than trying to "build up" from zero.</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">So in your case, you can start with the ImgLib2 Examples dependencies block, run dependency:analyze, and adjust the POM according to its recommendations.</span></div><div><br></div><div><div>> When I go to my NetBeans project dependence, select Add dependency,</div><div>> then type SCIF to the query text box, I get a huge list of</div><div>> possibilities.</div></div><div><br></div><div>The dependency you probably want is io.scif:scifio (i.e.: a groupId of io.scif, and an artifactId of scifio). Presumably at the latest version. You can search for that here:</div><div><br></div><div> <a href="http://maven.imagej.net/index.html#nexus-search;gav~io.scif~scifio~~~" target="_blank">http://maven.imagej.net/index.html#nexus-search;gav~io.scif~scifio~~~</a><br></div><div><br></div><div>So your dependency block in this case would be:</div><div><br></div><div><div> <dependency></div><div> <groupId>io.scif</groupId></div><div> <artifactId>scifio</artifactId></div><div> <version>0.17.1</version></div><div> </dependency></div></div><div><br></div><div>Note that that block of XML is available for copy-pasting from the link above.</div><div><br></div><div>> <span style="font-family:arial,sans-serif;font-size:13px">I am completely new to maven</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div>For more information, see:</div><div> <a href="http://imagej.net/Maven" target="_blank">http://imagej.net/Maven</a></div><div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px">Regards,</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Curtis</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 2, 2014 at 6:05 PM, Michael Ellis <span dir="ltr"><<a href="mailto:michael.ellis@dsuk.biz" target="_blank">michael.ellis@dsuk.biz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">I am investigating the using ImgLib2 for a project.<div><br></div><div>I am using NetBeans and have managed to create a NetBeans Mavern project and have added a dependency for ImgLib2 Core Library and that seems to be working OK.</div><div><br></div><div>I now want to add the least possible requirements for the purpose of opening some image files.</div><div><br></div><div>How do I establish what Maven projects I need to include? </div><div><br></div><div>I have cloned the ImgLib2 Examples project and got that working but that seems to include all manner of things that I suspect I do not need.</div><div><br></div><div>When I go to my NetBeans project dependence, select Add dependency, then type SCIF to the query text box, I get a huge list of possibilities.</div><div><br></div><div>I am completely new to maven and so do not know what I am doing with it!</div><span><font color="#888888"><div><br></div><div>— Michael Ellis</div><div>Digital Scientific UK Ltd.</div><div><span style="border-collapse:separate;font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></span><br>
</div>
<br></font></span></div><br>_______________________________________________<br>
ImageJ-devel mailing list<br>
<a href="mailto:ImageJ-devel@imagej.net" target="_blank">ImageJ-devel@imagej.net</a><br>
<a href="http://imagej.net/mailman/listinfo/imagej-devel" target="_blank">http://imagej.net/mailman/listinfo/imagej-devel</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div></div><br>_______________________________________________<br>
ImageJ-devel mailing list<br>
<a href="mailto:ImageJ-devel@imagej.net" target="_blank">ImageJ-devel@imagej.net</a><br>
<a href="http://imagej.net/mailman/listinfo/imagej-devel" target="_blank">http://imagej.net/mailman/listinfo/imagej-devel</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div></div></div><br>_______________________________________________<br>
ImageJ-devel mailing list<br>
<a href="mailto:ImageJ-devel@imagej.net" target="_blank">ImageJ-devel@imagej.net</a><br>
<a href="http://imagej.net/mailman/listinfo/imagej-devel" target="_blank">http://imagej.net/mailman/listinfo/imagej-devel</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div></div><br>_______________________________________________<br>
ImageJ-devel mailing list<br>
<a href="mailto:ImageJ-devel@imagej.net">ImageJ-devel@imagej.net</a><br>
<a href="http://imagej.net/mailman/listinfo/imagej-devel" target="_blank">http://imagej.net/mailman/listinfo/imagej-devel</a><br>
<br></blockquote></div><br></div>