Can't Run Plugins

Hi All

I’ve just started a project attempting to use ImageJ to analyse AFM images and am trying to use two different plugins, one was made by someone who previously worked on this project and the other is Open_NV which I found on the ImageJ site.
I downloaded Fiji and have been trying various different things to run the plugins but nothing seems to work. I either get an error message “java.lang.NullPointerException” and then a list of exceptions (if I paste the plugin code straight into Fiji’s plugin creator) or a series of errors about how the compiler needs to be updated if I save the .java from Netbeans.
Can anyone offer any advice?
Cheers

Welcome to the forum, @mconfused!

Can you please describe the exact workflow you are doing, and paste the exact error message you receive? You mention “Fiji’s plugin creator” (by which I assume you mean the ImageJ2 Script Editor), as well as NetBeans.

We will have an easier time helping you if you write up a thorough issue report.

Without knowing any more about what you are trying to achieve: have you seen the minimal-ij1-plugin example project?

1 Like

Hi @ctrueden, thanks for the reply!

Since writing that message I have gone through the minimal-ij-1-plugin project and got that to work fine.

I’ve then been using Netbeans to create a full Maven project for the plugins I wanted to use. One of them (Open_NV) works but I get the message:

Open_NV not up-to-date because 1 source files are not up-to-date (C:\Users\Matt\AppData\Local\Temp\java4005629491866749542\src\main\java\Open_NV.java)
Compiling 1 file in C:\Users\Matt\AppData\Local\Temp\java4005629491866749542
[-classpath,C:\Users\Matt\AppData\Local\Temp\java4005629491866749542\target…)
No javax.tools.JavaCompiler available. Checking for explicit javac.
No javac.jar found (looked in C:\LMAWOR~1\Fiji.app\jars)!
java.lang.ClassNotFoundException: com.sun.tools.javac.Main
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Could not find javac java.lang.ClassNotFoundException: com.sun.tools.javac.Main, falling back to system javac
Executing: ‘javac’ ‘-classpath’ 'C:\Users\Matt\AppData\Local\Temp\java4005629491866749542\target\classes…
warning: Supported source version ‘RELEASE_6’ from annotation processor ‘org.scijava.annotations.AnnotationProcessor’ less than -source '1.8’
1 warning

I had to truncate this quite a bit but that’s the gist of it.

The other plugin doesn’t work but I get the message:

java.lang.NullPointerException

Followed by a list of addresses. I had a look on the forums here and it seemed like it could be a problem with using JDK 1.8 with Fiji, I’m not really sure though.

Sorry for the long post and thanks again for your help!

@mconfused Do you have the Java-8 update site turned on?

When did you download Fiji? In 2016? Or earlier? If earlier, try downloading a fresh copy. It will have the Java-8 update site turned on.

See also ImageJ HOWTO - Java 8, Java 6, Java 3D.

Your error message indicates the SciJava Java compilation logic (known as “MiniMaven”) cannot find the Java compiler. Are you sure you have a JDK installed on your system?

I downloaded Fiji a couple of days ago so it should definitely have the update site turned on.

I should have a JDK installed as I downloaded Netbeans and JDK 8 in one package from the Oracle website and when I checked in program list there was "Java SE Development Kit 8 Update 101 (64-bit)

Ok, I’ve managed to get both plugins to work but now both cause the javac warning that I posted above, I think it cant find the compiler where it expects to so it then uses the compiler on the system which is out of date. I’m not sure how to solve this though.

Try moving the .java files outside your ImageJ installation. It is possible that the Java script engine is picking them up as scripts, which means that it tries to compile them again every time you run them.

Better is to compile them once into .class files, and place those files into your plugins folder. Then they will appear in the menus and be usable without those warning messages every time.

@ctrueden, Thats solved it, brilliant! Thanks very much for the help :smiley:

Weirdly before I tried that I had managed to get them both to work by disabling the Java 8 update site for Fiji, I’m not too sure why that worked though. I’m pretty new to this kind of programming do you know of any resources where I can learn a bit more about it?

Thanks again for all the help!!

1 Like

If you want to write ImageJ plugins, see these pages:

The docs certainly aren’t perfect, but there is a lot (too much? :stuck_out_tongue:) there.

If you mean learn programming in general, then I recommend HackerRank. It has coding exercises at many levels, from very beginning to very advanced. If you are mathematically inclined, there is also Project Euler, and if you are a competitive person, you could check out TopCoder although it seems like they are quite different than years ago when I did their challenges.

1 Like

That looks brilliant cheers, I did a bit of programming during my degree but haven’t done anything beyond some microcontroller stuff for a few years so this should help me get back into it :relaxed:

1 Like