How to import Java file into Eclipse
I have downlo开发者_C百科aded a JAVA FILE and I don't know how to import it in Eclipse.
If it's a plain Java file (.java), just put it somewhere inside the src
folder of your project. Also, you will have to change its package name, so if it says:
package com.some.package;
And you copy it to src/com/your/app
, then you have to change the package name to this:
package com.your.app;
By the way, there's no "Import Java file" option in Eclipse, don't waste time looking for an automatic way to do it.
The best way is take the file and drop it to the default workspace eclipse folder. Then open the eclipse and refresh the project
If you want to create a new project out of it then follow:
New -> Java Project -> Create Project from existing source.
Give correct path and proceed further.
精彩评论