Skip to content

Import project (jar) into Eclipse

I got a .jar file which I need to import into Eclipse. However, I don’t want to have the jar as a referenced library. I need the .jar to be included like a “normal” project, with packages(!) and .java files.

I tried to do the following:
New Java project -> Import -> General -> Archive File. In this case, when I place this jar also as a referenced library, it is imported but with .class files.

New Java Project -> Import -> General -> File System. Imports the .java files, but the packages are lost and are normal folders. Also, the files are somehow strange, because the “j” in the icon looks differently, and errors are not noticed (no underlining)

Importing “Existing Projects into Workspace” doesn’t work at all, it says that there is no project. I also tried to import the jar as a zip after extracting it, this gives me the -java files, but it destroys the packages.

Does anyone know how to import this correctly?

Answer

I have managed it this way:
New Java Project -> Java settings -> Source -> Link source (Source folder). There I added my decompiled jar and it was imported correctly 🙂