First, try
Window -> Preferences -> General -> Workspace. There you can check
“Save automatically before build” and “Build automatically.”
If that does not work,
PLEASE TRY
Preferences -> Run/Debug -> Launching -> “Save dirty editors before
launching”