Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 373
Jane Doe Avatar asked Mar 13 '13 08:03

Jane Doe


People also ask

Why can I not add external JARs in eclipse?

You have selected the JRE System Library in the panel. Un-select that and you will be able to add external jars. You can click on the Classpath or Modulepath to move the control away.


1 Answers

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 :)

like image 189
Jane Doe Avatar answered Oct 27 '22 11:10

Jane Doe