Java Stack Traces: Unknown Source

If you get a stack trace with “Unknown Source” like below…

Exception in thread "main" java.lang.NumberFormatException: For input string: "3.1415" at java.lang.NumberFormatException.forInputString( at java.lang.Integer.parseInt( at ExampleCli.parseNumericArgument(Unknown Source) at ExampleCli.parseCliOptions(Unknown Source) at ExampleCli.main(Unknown Source)

…it means that the program lacks the relevant debugging information. Specifically the class files are missing the LineNumberTable attribute (JVMS 4.7.12).

Possible reasons

  • The code has been compiled with the -g:none javac option.

  • The class files has been processed by an obfuscator or minimizer


  • Make sure you’re using the JDK classes and not the JRE classes (if the lines refer to classes in the standard API)

  • Recompile with debug information. If the lines refer to some third party library for which you don’t have access to the source code, you’re out of luck.