ImageJ-win64.exe: cannot start plugin in headless mode

Greetings!

I want to use bUnwarpJ plugin from command line with Fiji (ImageJ 1.51k).
My first step is to call “bUnwarpJ_ -help”:
ImageJ-win64.exe --ij2 --headless --run "D:/Program Files/Fiji.app/plugins/bUnwarpJ-2.6.5.jar" bUnwarpJ_ help_
gives no output.

What can be the root cause for this?
Thank you.

ImageJ-win64.exe --ij2 --headless --console

gives:

D:\Program Files\Fiji.app>Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
java.lang.IllegalArgumentException: Cannot handle app name in ij.gui.YesNoCancelDialog's public <init>(java.awt.Frame parent, java.lang.String title, java.lang.String msg)
        at net.imagej.patcher.CodeHacker.replaceAppNameInCall(CodeHacker.java:446)
        at net.imagej.patcher.LegacyExtensions.insertAppNameHooks(LegacyExtensions.java:419)
        at net.imagej.patcher.LegacyExtensions.injectHooks(LegacyExtensions.java:291)
        at net.imagej.patcher.LegacyInjector.inject(LegacyInjector.java:308)
        at net.imagej.patcher.LegacyInjector.injectHooks(LegacyInjector.java:109)
        at net.imagej.patcher.LegacyEnvironment.initialize(LegacyEnvironment.java:101)
        at net.imagej.patcher.LegacyEnvironment.applyPatches(LegacyEnvironment.java:495)
        at net.imagej.patcher.LegacyInjector.preinit(LegacyInjector.java:397)
        at net.imagej.patcher.LegacyInjector.preinit(LegacyInjector.java:376)
        at net.imagej.legacy.LegacyService.<clinit>(LegacyService.java:134)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
        at java.lang.Class.newInstance(Class.java:442)
        at org.scijava.service.ServiceHelper.createServiceRecursively(ServiceHelper.java:302)
        at org.scijava.service.ServiceHelper.createExactService(ServiceHelper.java:269)
        at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:231)
        at org.scijava.service.ServiceHelper.createServiceRecursively(ServiceHelper.java:340)
        at org.scijava.service.ServiceHelper.createExactService(ServiceHelper.java:269)
        at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:231)
        at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:194)
        at org.scijava.service.ServiceHelper.loadServices(ServiceHelper.java:166)
        at org.scijava.Context.<init>(Context.java:278)
        at org.scijava.Context.<init>(Context.java:234)
        at org.scijava.Context.<init>(Context.java:174)
        at org.scijava.Context.<init>(Context.java:160)
        at net.imagej.ImageJ.<init>(ImageJ.java:77)
        at net.imagej.Main.launch(Main.java:61)
        at net.imagej.Main.main(Main.java:68)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at net.imagej.launcher.ClassLauncher.launch(ClassLauncher.java:279)
        at net.imagej.launcher.ClassLauncher.run(ClassLauncher.java:186)
        at net.imagej.launcher.ClassLauncher.main(ClassLauncher.java:77)
Caused by: javassist.CannotCompileException: No code replaced!
        at net.imagej.patcher.CodeHacker$EagerExprEditor.instrument(CodeHacker.java:1280)
        at net.imagej.patcher.CodeHacker.replaceAppNameInCall(CodeHacker.java:443)
        ... 36 more

Dear @AKazak,

the java.lang.IllegalArgumentException: Cannot handle app name in ij.gui.YesNoCancelDialog's public exception has already been fixed in the development versions of the launcher. We are currently working on getting our release machinery up an running again (see Fiji(ImageJ) takes too long to load (on linux), together with a lengthy error message for more details)

Did you look at the “official way” for starting bUnwarpJ from the commandline over at the ImageJ wiki:

java -Xmx512m -cp $IJDIR/ij.jar:$IJDIR/plugins/bUnwarpJ_.jar bUnwarpJ_ -help

Best,
Stefan

Dear Stefan,

OK - I will be waiting for the release with the Exception fixed.

As for the official way I tried it, but without success:

D:\Program Files\Fiji.app>java -Xmx512m -cp “D:/Program Files/Fiji.app/ij.jar”:“D:/Program Files/Fiji.app/plugins/bUnwarpJ_.jar” bUnwarpJ_ -help
Error: Could not find or load main class bUnwarpJ_

D:\Program Files\Fiji.app>java -Xmx512m -cp “D:/Program Files/Fiji.app/imagej-2.0.0-rc-59.jar”:“D:/Program Files/Fiji.app/plugins/bUnwarpJ_-2.6.5.jar” bUnwarpJ_ -help
Error: Could not find or load main class bUnwarpJ_

D:\Program Files\Fiji.app>java -Xmx512m -cp “D:/Program Files/Fiji.app/plugins/imagej-2.0.0-rc-59.jar”:“D:/Program Files/Fiji.app/plugins/bUnwarpJ_-2.6.5.jar” bUnwarpJ_ -help
Error: Could not find or load main class bUnwarpJ_

I suspect that something wrong with -cp paths. I not sure what should I use in place of ij.jar and bUnwarpJ_.jar
Can you suggest me what is wrong in my syntax please?
Thank you.

Ignacio Arganda-Carreras helped me to work out correct syntax for my case:

java -Xmx100g -cp “D:/Program Files/Fiji.app/jars/ij-1.51l-SNAPSHOT.jar”;“D:/Program Files/Fiji.app/plugins/bUnwarpJ_-2.6.5.jar” bunwarpj.bUnwarpJ_ -elastic_transform “C:/Users/a.kazak/Desktop/Registration/bUnwarpJ/HQ/SI.tif” “C:/Users/a.kazak/Desktop/QEMSCAN-MAPS Registration/bUnwarpJ/HQ/TI.tif” “C:/Users/a.kazak/Desktop/Registration/bUnwarpJ/HQ/TP.txt” “C:/Users/a.kazak/Desktop/Registration/bUnwarpJ/HQ/output.tif”

:grinning:

1 Like