This is usually because Eclipse is using a different version of Java. To fix it, just turn off “Build Automatically”, so Eclipse doesn’t auto compile. Now, when you run your Mendix application, it should recompile the Java Actions correctly as part of the build process.
Hope this helps!