Sundararajan's Weblog

  • Java
    December 17, 2008

Debugging option for javac and javafxc

Guest Author

I work on JavaFX compiler these days. The command line (debugging) option that I often use is -doe ("dump on error"). This option prints stack trace of the compiler when error message is printed. NOTE: This is an internal option and can be removed any time without notice! But, it is useful for debugging. This option works for javac as well as javafxc. When I misspelled "class" as "clas" and run compiler with -doe option, I got the stack trace below:

$ javac -doe t.java
t.java:1: class, interface, or enum expected
clas t {}

at com.sun.tools.javac.util.Log.writeDiagnostic(Log.java:565)

at com.sun.tools.javac.util.Log.report(Log.java:523)

at com.sun.tools.javac.util.Log.error(Log.java:404)

at com.sun.tools.javac.parser.Parser.reportSyntaxError(Parser.java:282)

at com.sun.tools.javac.parser.Parser.syntaxError(Parser.java:267)

at com.sun.tools.javac.parser.Parser.classOrInterfaceOrEnumDeclaration(Parser.java:2206)

at com.sun.tools.javac.parser.Parser.typeDeclaration(Parser.java:2180)

at com.sun.tools.javac.parser.Parser.compilationUnit(Parser.java:2126)

at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:509)

at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:550)

at com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java:801)

at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727)

at com.sun.tools.javac.main.Main.compile(Main.java:353)

at com.sun.tools.javac.main.Main.compile(Main.java:279)

at com.sun.tools.javac.main.Main.compile(Main.java:270)

at com.sun.tools.javac.Main.compile(Main.java:69)

at com.sun.tools.javac.Main.main(Main.java:54)
1 error

Join the discussion

Comments ( 1 )
  • Rémi Forax Thursday, December 18, 2008

    Really cool.

    It didn't know that.

    many thanks,


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.