In eclipse console can I click on Stack trace and it should take me to java instead of .class file?

怎甘沉沦 提交于 2019-12-11 06:03:04

问题


My config is like this

Java Project1: IADTPrj
J2ee Project2: TestJ2EE references IADTPrj

Classpath entry <classpathentry kind="lib" path="/IDCT/bin"/>

I have in logger get some outputs like (SomeClass.java:30) which I want to click to and go to its java file line no. 30. But eclipse is taking me to its .class file. To make matters worse i have a java decompiler installed which takes me to a look alike java code of SomeClass.class but again to the wrong line number.(line numbers are not preserved after decompiling. But it says which original java line number corresponds to current decompiled class!)

Now is this possible to define the search path for finding the hyperlinks, so that I can specify to search for java files first in the related project and then class files. So that I can edit SomeClass.java directly and re-deploy.


回答1:


This is because you did not attach any source (jar or folder) to that class.

There are many ways to attach a source jar or folder to a jar; an easy one is to right click on the jar in the package explorer and select properties.

If you have jadclipse, then if configured correctly, the real source code should take precedence over the decompiled code. Please be aware however, that if you change the configuration and test the same class, you will think that your configuration will not be taken into account because the decompiled source will still show up. I don't know of any other fix than restart eclipse (or test another class).




回答2:


You can copy the stack trace to a Java Stack Trace console. In the Console, switch to a new Java Stack Trace console, paste the stack trace and it will be immediately clickable.



来源:https://stackoverflow.com/questions/5116142/in-eclipse-console-can-i-click-on-stack-trace-and-it-should-take-me-to-java-inst

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!