Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import Java file into Eclipse

I have downloaded a JAVA FILE and I don't know how to import it in Eclipse.

like image 700
sean Avatar asked Dec 17 '22 18:12

sean


2 Answers

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.

like image 136
Cristian Avatar answered Dec 28 '22 07:12

Cristian


The best way is take the file and drop it to the default workspace eclipse folder. Then open the eclipse and refresh the project

like image 41
Evri Avatar answered Dec 28 '22 07:12

Evri