[ImageJ-devel] DefaultLegacyService.preinit Error

Jay Warrick warrick at wisc.edu
Fri Apr 25 14:23:45 CDT 2014


Hi All,

I'm creating a single instance of ImageJ (ImageJ2) in my program and using this instance to access the various services of ImageJ2. However, in previous work with Curtis Rueden, we found we had to add the following static code to the class which I use to access this single ImageJ instance so that the services load (I believe because of the presence of the ImageJ1 jar included along with the ImageJ2 group of jars). 

static
{
	DefaultLegacyService.preinit();
}

However I ran into the following issue. 

With Java 1.6 and 1.7 installed on my system everything worked great. No issues. I downloaded and installed Java 1.8 and then I received the following error upon reaching this preinitialization code.

java.lang.IllegalArgumentException: Cannot handle app name in
ij.ImageJ's public <init>(java.applet.Applet applet, int mode)

at imagej.legacy.CodeHacker.replaceAppNameInCall(CodeHacker.java:498)

at imagej.legacy.LegacyExtensions.insertAppNameHooks(LegacyExtensions.java:591)

at imagej.legacy.LegacyExtensions.injectHooks(LegacyExtensions.java:516)

at imagej.legacy.LegacyInjector.injectHooks(LegacyInjector.java:154)

at imagej.legacy.LegacyInjector.injectHooks(LegacyInjector.java:57)

at imagej.legacy.DefaultLegacyService.<clinit>(DefaultLegacyService.java:109)

I then used the old but useful "Java Preferences.app" to change the default order of preferred jres. I moved 1.7 ahead of 1.8 and the application worked again. Then I put 1.8 above 1.8 again and the problem no longer occurred. I can't repeat the problem on my computer but another person is having the same issue. I'll likely have him do what I did but this seems like a silly work around. Do you know what might be the root cause? Am I just using the ImageJ2 project with inappropriate/unsupported jre's even though it eventually works under 1.8.

Thanks,

Jay




More information about the ImageJ-devel mailing list