Attach the Source in Eclipse of a jar

前端 未结 11 1585
清歌不尽
清歌不尽 2020-11-28 06:46

I added a Student.jar into my Build Path in my eclipse like this-

Right click on the project->BuildPath->Configure Build P

相关标签:
11条回答
  • 2020-11-28 07:35

    This worked for me for Eclipse-Luna:

    1. Right Click on the *.jar in the Referenced Libraries folder under your project, then click on Properties
    2. Use the Java Source Attachment page to point to the Workspace location or the External location to the source code of that jar.
    0 讨论(0)
  • 2020-11-28 07:39

    I faced the same issue and solved using the below steps. Go to Windows->preferences->Editors->File Associations

    Here click on Add then type .class click on OK

    again click on Add then type .classwithoughtsource click on OK

    Now you will be able to see JadClipse option under Java section in Windows->Preferences

    Please provide the path of jad.exe file as shown below.

    Path for Decompiler-C:\Users\ahr\Documents\eclipse-jee-galileo-SR2-win32\jad.exe Directory for temporary Files-C:\Users\ahr.net.sf.jadclipse

    click on Apply

    Now you should be able to see the classfiles in proper format.

    0 讨论(0)
  • 2020-11-28 07:43

    A .jar file usually only contains the .class files, not the .java files they were compiled from. That's why eclipse is telling you it doesn't know the source code of that class.

    "Attaching" the source to a JAR means telling eclipse where the source code can be found. Of course, if you don't know yourself, that feature is of little help. Of course, you could try googling for the source code (or check wherever you got the JAR file from).

    That said, you don't necessarily need the source to debug.

    0 讨论(0)
  • 2020-11-28 07:44

    I have faced same problem and resolved it by using following scenario.

    1 ) First we have to determine which jar file's source code we want along with version number. For Example "Spring Core » 4.0.6.RELEASE" 2 ) open https://mvnrepository.com/ and search file with name "Spring Core » 4.0.6.RELEASE". 3 ) Now Maven repository will show the the details of that jar file. 4 ) In that details there is one option "View All" just click on that. 5 ) Then we will navigate to URL "https://repo1.maven.org/maven2/org/springframework/spring-core/4.0.6.RELEASE/".

    6) there so many options so select and download "spring-core-4.0.6.RELEASE-sources.jar " in our our system and attach same jar file as a source attachment in eclipse.

    0 讨论(0)
  • 2020-11-28 07:47

    Eclipse is showing no source found because there is no source available . Your jar only has the compiled classes.

    You need to import the project from jar and add the Project as dependency .

    Other option is to go to the

    Go to Properties (for the Project) -> Java Build Path -> Libraries , select your jar file and click on the source , there will be option to attach the source and Javadocs.

    0 讨论(0)
提交回复
热议问题