16

I have a project in Java that I am stepping through and when I'm using external libraries e.g. jdom.jar I end up hammering step over to get out on the "Class File Editor". I really don't care about whats in these libraries I'm just using them to process things for my own code.

Is there anyway to get around this popping up?

It's so frustrating hammering step over every time I accidentally step into a class file which I know has no source and is completely pointless me looking through.

image below:

enter image description here

Cedric Reichenbach
9,4197 gold badges59 silver badges92 bronze badges
asked Mar 30, 2012 at 9:16
1
  • 2
    Press 'F7' for STEP Return and then be more careful next time... you shouldn't be decompiling libraries (especially not commercial ones). Commented Mar 30, 2012 at 9:40

9 Answers 9

17

There are various solutions:

  1. You can download the sources and attach them (select the dependency in the Package Explorer, open the Properties dialog for it, set the path under "Java Source Attachment")

  2. If you don't have the source, install JADClipse

  3. Use "Step Over" (F6) instead of "Step Into" (F5)

  4. If you accidentally stepped into some code, use "Step Return" (F7) to run the whole method and resume debugging after it has returned.

  5. You can tell Eclipse what you don't want to step into using "step filters".

answered Mar 30, 2012 at 9:33
Sign up to request clarification or add additional context in comments.

Comments

9

Simple way-- Works for me :)

Select Attach Source->(External Location Radio Box)External File-> Select src.zip from java/jdk1.x.x.xx folder

and done!!

answered Jun 16, 2016 at 14:21

1 Comment

If scr.zip link is broken, you need to: sudo apt-get install openjdk-8-source and then it sould work. ;-)
5

Go to Project> Properties> Java Build Path> Libraries

Expand JRE System Library.

Expand rt.jar.

Select Source attachment and double click or Edit. Type path the source code file (External File...) and press OK.

enter image description here

answered May 31, 2017 at 6:26

1 Comment

I'm trying that, but it reads "Source attachment: (None) - non modifiable" and I can't edit it.
3

You can try JADClipse

At least you will see the code, and be able to step return and step resume more easily. I don't think there is any way to skip the classes u dont have the source for.

answered Mar 30, 2012 at 9:22

Comments

3
  1. Install Enhanced Class Decompiler from Eclipse Marketplace, restart when prompt.
  2. Go to Preferences->General->Editors->File Associations, selected both ".class" and ".class without source" associating them to Class Decompiler Viewer as default.
  3. In Preferences->Java->Decompiler check that the Default Class Decompiler suits your JDK version.
answered Jan 21, 2021 at 20:26

1 Comment

Great, this worked. This should be the accepted answer
0

open 1- help 2- Install New Software in work with click at Add http://adt-addons.googlecode.com/svn/trunk/source/com.android.ide.eclipse.source.update add source code then in attach source chose external location in patch click external file documents - eclipse - plugins - choose package we just download (source code package) example : com.android.ide.eclipse.source...... - 14 sources.zip i hope this work with you

answered May 29, 2014 at 8:14

Comments

0

If you are using gradle, port your dependencies to eclipse classpath by using the eclipse plugin.

answered Dec 14, 2017 at 22:43

Comments

0

Unchecking the option Java -> Debug -> "Use advanced source lookup (JRE 1.5 and higher)" checkbox resolves this issue for me.

answered Mar 22, 2022 at 6:08

Comments

0

For me the issue was in pom.xml of the debugged project.

In my dependent project - the dependency version was 1.9.3

<dependencies>
 <dependency>
 <groupId>com.aaa</groupId>
 <artifactId>abcautomationlayer</artifactId>
 <version>1.9.3</version>
 </dependency>
 </dependencies>

Whereas it should have been 1.9.3-SNAPSHOT. As the primary project has the version info in that way

<project xmlns="http://maven.apache.org/POM/4.0.0"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 <modelVersion>4.0.0</modelVersion>
 <groupId>com.aaa</groupId>
 <artifactId>abcautomationlayer</artifactId>
 <version>1.9.3-SNAPSHOT</version>

So changing from 1.9.3 -> 1.9.3-SNAPSHOT in dependent project did the trick

answered Apr 25, 2022 at 9:28

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.