U cannot add directly java file in your eclipse.U will add java files with help of modeler.In your microflow add activity called
‘Java action call’.Here you need to create java action name.Afterthat It will ask return type and input parameter so u need to give those argument based on your requirement.Then u need to give deploy for eclipse which create java files in your eclipse.
If you want to call Java from a Mendix app, create a Java Action first. Once you’ve created this, use the “Deploy for Eclipse” option in the Project menu of your Mendix Modeller. This will create the necessary stub files you can use to call Java code in your project’s javasource directory.
If you need your java to call any .jar files, drop these into your userlib directory. Remember to also add an empty file with the name of the jar file, appended with your module’s name and RequiredLib so anyone using this in future knows where the .jar file comes from and why it is being used.
There is some good documentation that is worth reading that explain this in far more detail.
Hope this helps