Include filename/line number corresponding to System.out.print statements in Eclipse Console

前端 未结 3 2041
星月不相逢
星月不相逢 2020-12-16 06:05

Is there a way to show line numbers in the Eclipse console?

My intent here is to show in the Eclipse console the file/line number that produced the output, not a se

3条回答
  •  爱一瞬间的悲伤
    2020-12-16 06:34

    At first I will rephrase your question in my own words so that you can check if I got your question right: You want to have all console output to be linked to the source code which produced it.

    In this case this is NOT possible without using some modifying the standard libraries (System.out and System.err). Such a code would probably use the current stacktrace (see e.g. Is there a way to dump a stack trace without throwing an exception in java?) to determine the code (and line-number) where the print-statement was called. The next step would be to create an eclipse plugin which uses the gathered information to jump to the determined line (or to make eclipse think it is displaying a stacktrace).

提交回复
热议问题