Line Numbers Missing From Stack Trace

Line Numbers Missing From Stack Trace

You may have seen “(Compiled Code)” in a stack trace and wondered why a line number was not displayed instead. This occurs because as of release 1.1.5 of the Java Development Kit (JDK), the default behavior is to use a Just-In-Time (JIT) compiler. Once the JIT compiler has processed the code, the line numbers no longer exist and cannot be displayed. For example:

 public class jitest {	public static void main(String[] args)					throws Exception {		jitest jt = new jitest();	}  //  public static void main()	public jitest() throws Exception {		runtest();	}  //  public jitest()	private void runtest() throws Exception {		for (int i = 0; i < 10000; i++) {};		throw new Exception("No line numbers");	}  //  private void runtest()}  //  public class jitest

Running this code with the Java Virtual Machine (JVM) from 1.1.5 or later will produce this stack trace when the exception is thrown:

 java.lang.Exception: No line numbers	at java.lang.Throwable.(Compiled Code)	at jitest.runtest(Compiled Code)	at jitest.(	at jitest.main(

Notice that the stack trace does not identify the specific line where the exception was thrown, but merely reads "(Compiled Code)". In this trivial example, it's obvious where the exception was generated, but in a more complex class, it can be very difficult to determine where, for example, a NullPointerException occurred. To get around this behavior, you can temporarily disable the JIT using a command-line option. For a Java 1.1.x JVM, use the

Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved