Re: Question about debugging .class file



George George via JavaKB.com wrote:

When debugging a C or C++ binary file, the file is different from the release version of binary file (debug version binary file is larger). My question is, if we want to debug a Java binary file (.class file), is the version of file (which we use to debug) the same as the file (which we are going to release)? If they are different, shall we add some additional options to compiler in order to make debug version binary file be different from release version binary file?

http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/javac.html#options

You can strip the debug information with -g:none. -O used to do the same thing, but that appears to be gone.

It shouldn't make much difference to the performance if you leave debugging information in. Line numbers in particular can be handy to diagnose errors on production systems.

If you want to hide your code from decompilation, best use and obfuscator. There's lots of information left in the light compilation from source to byte code. Type names, field names, method names and most of the structure.

http://mindprod.com/jgloss/obfuscator.html
http://mindprod.com/jgloss/decompiler.html

The real question: is size important to you. For both ye olde C++ on a floppy and Java applet I have come into a company and shrunk the binary considerably by switching off the default debug info. But if you're shipping to your own servers, on DVD or over broadband, size matters not.

Tom Hawtin
--
Unemployed English Java programmer
http://jroller.com/page/tackline/
.



Relevant Pages

  • Re: Question about debugging .class file
    ... Thomas Hawtin wrote: ... >> version of binary file (debug version binary file is larger). ... What do you mean "light compilation from source to byte code"? ...
    (comp.lang.java.help)
  • Re: Question about debugging .class file
    ... >version binary file is always different from release version ... it will strip the debug stuff. ... library code bound into the class file. ... http://mindprod.com Again taking new Java programming contracts. ...
    (comp.lang.java.help)
  • [PATCH 4/4] ide-disk: fix issues found by checkpatch.pl
    ... There are no changes to the resulting drivers/ide/ide-disk.o binary file ... -//#define DEBUG ... static int proc_idedisk_read_capacity ... ide_task_t args; ...
    (Linux-Kernel)
  • Re: Question about debugging .class file
    ... >>version of binary file (debug version binary file is larger). ... >The main choice is whether to use Java.exe in the JRE or the JDK. ... So, no matter what methods are used, the debug ...
    (comp.lang.java.help)
  • Re: Question about debugging .class file
    ... >version of binary file (debug version binary file is larger). ... The main choice is whether to use Java.exe in the JRE or the JDK. ... one in the JDK has extra debugging turned on. ...
    (comp.lang.java.help)