Henrik Paul
Henrik Paul

Reputation: 67703

How to add debug information when compiling with Java's Compiler API

What do I need to do to control whether my classes compiled with a JavaCompiler will include debug information or not?

I'm thinking it has something to do with the getTask()-method's options parameter, but I can't find any references on whether that assumption is correct to start with, and if so, what is the correct way to control that?

Upvotes: 4

Views: 3980

Answers (2)

Romain Hippeau
Romain Hippeau

Reputation: 24375

Check out http://www.javabeat.net/articles/73-the-java-60-compiler-api-1.html In JavaCompiler class there is a field to pass in the options -g is the one for debug information.

Upvotes: 2

Michael Zilbermann
Michael Zilbermann

Reputation: 1428

Maybe you could search further in the "options" argument of the getTask() method, which allows to pass options to the compiler; in your case it would be some "-g:none" option as detailed in http://java.sun.com/javase/6/docs/technotes/tools/windows/javac.html#options

Upvotes: 1

Related Questions