tutorials
tutorials copied to clipboard
Invalid service: net.imagej.legacy.LegacyService
It can't run with error for all demos:
Exception in thread "main" java.lang.IllegalArgumentException: Invalid service: net.imagej.legacy.LegacyService
at org.scijava.service.ServiceHelper.createExactService(ServiceHelper.java:278)
at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:229)
at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:192)
at org.scijava.service.ServiceHelper.loadServices(ServiceHelper.java:164)
at org.scijava.Context.
static {
LegacyInjector.preinit();
}
I tried to add LegacyInjector.preinit(); but still failed.
@MurphyHou123 Have you tried a 1.8 JDK?
@MurphyHou123 I second what @sean-leichtle suggests, to use OpenJDK 8. The new module system in Java 9 was tightened up in Java 17+ to make imagej-legacy's job of patching the original ImageJ more difficult.
Alternately, if you really need to use Java 17+, you can try launching with --add-opens=java.base/java.lang=ALL-UNNAMED passed to the JVM.