How to import Java file in Eclipse

I downloaded JAVA FILE and don’t know how to import it into Eclipse.

+4
source share
3 answers

If it is a simple Java file (.java), just put it in the src folder of your project. In addition, you will have to change the name of your package, so if it says:

 package com.some.package; 

And you copy it to src/com/your/app , then you need to change the package name to this:

 package com.your.app; 

By the way, in Eclipse there is no option "Import Java file", do not waste time looking for an automatic way to do this.

+9
source

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

+2
source

If you want to create a new project from it, follow these steps:

Create -> Java Project -> Create Project from Existing Source.

Give the right way and continue on.

+1
source

Source: https://habr.com/ru/post/1335082/


All Articles