Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I want debugger to open java file instead of class (from depending library)

In eclipse workset I have an android library and an application which uses this library. When I set a breakpoint in java file from application debugger stops and java file is available. But when I debug depending library instead of opening file with java extension file with "class" extension is opened in debugger. Is it possible to make eclipse open "java" file instead of "class"?

like image 458
Solvek Avatar asked Jan 25 '12 12:01

Solvek


People also ask

How do you run a class in debug mode?

Set a breakpoint in your main class by clicking in the left margin of the line where you want to set the breakpoint. The line with the breakpoint is highlighted in pink. Right-click the project's node again and choose Debug Project. The target should run and start execution of the program.

How do I Debug a Java file?

A Java program can be debugged simply by right clicking on the Java editor class file from Package explorer. Select Debug As → Java Application or use the shortcut Alt + Shift + D, J instead. Either actions mentioned above creates a new Debug Launch Configuration and uses it to start the Java application.

Can we Debug class file?

If the class file contains debug attributes, you can debug it in the Eclipse Class Decompiler Viewer. There are two ways to debug a class file. The first way is to set the decompiler preference, and to realign the line number. The second way is to check the debug mode in the decompiler menu bar.

How do I start the Java program in debug mode?

Enable JVM DebuggingClick Java > JVM Settings tab. Under Debug Java Settings, select the Enable Debug checkbox. Provide JVM options as necessary by clicking the New button. If you substitute suspend=y, the JVM starts in suspended mode and stays suspended until a debugger attaches to it.


2 Answers

Right-click on the project and choose Properties, then select the Java Build Path section. On the Libraries tab you'll find a list of the JARs that the project is using; expand the JAR and you'll see a place for the "Source attachment." Select that and then use the Edit button to point Eclipse to where the source code lives.

like image 152
E-Riz Avatar answered Sep 19 '22 19:09

E-Riz


You have to set the source path for that jar/library. Is done in the Options->java build path if I racall correctly.

like image 1
BigMike Avatar answered Sep 19 '22 19:09

BigMike