Deleting debug-information
With Javac it is possible with the options "-g" and "-g:none" to either creating .class files with a lot of debug-code or small files without debug-code.
If you compile without any -g option, it compiles withsome debug-code.
Jabaco on the other side, creates only code with the same amount of debug code (for example the LineNumberTable and so).
If you want to remove it, have a look at
http://blogs.sun.com/ahe/entry/how_to_st…bug_information
There stand, that a
will remove all debug-code.
If you compile without any -g option, it compiles withsome debug-code.
Jabaco on the other side, creates only code with the same amount of debug code (for example the LineNumberTable and so).
If you want to remove it, have a look at
http://blogs.sun.com/ahe/entry/how_to_st…bug_information
There stand, that a
|
|
Source code |
1 |
pack200 -r -G debug.jar |
will remove all debug-code.
thanks for the idea.
Thanks for your response.
Quoted
There is a similar option in Jabaco:
In the project-explorer select your projectname (the very above item), then look into the properties editor.
Right next to the "Compile"-item you can select "Bytecode" or "Debug".
I have tried it now out, but it seems, that it don't work.
I have changed "Debug" to "Bytecode".
Then I have created a Button on the Form.
After it I have compiled it to jar. The jar I have then extracted.
With
|
|
Source code |
1 |
javap -c -s -l Module1 |
The output is
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
javap -s -l -c Modul
e1
Compiled from "Module1.jsrc"
public class Module1 extends java.lang.Object{
public static Form1 Form1;
Signature: LForm1;
public static void main(java.lang.String[]);
Signature: ([Ljava/lang/String;)V
Code:
0: aconst_null
1: astore_1
2: aconst_null
3: astore_2
4: new #22; //class VBA/VBArray
7: dup
8: invokespecial #23; //Method VBA/VBArray."<init>":()V
11: astore_3
12: aload_0
13: invokestatic #27; //Method VBA/VBArray.createVBArray:([Ljava/lang/Str
ing;)LVBA/VBArrayString;
16: astore_3
17: getstatic #20; //Field Form1:LForm1;
20: invokevirtual #32; //Method VB/AbstractForm.SetDefaultClose:()V
23: getstatic #20; //Field Form1:LForm1;
26: invokevirtual #35; //Method VB/AbstractForm.Show:()V
29: nop
30: return
31: nop
32: aload_1
33: checkcast #37; //class java/lang/Exception
36: invokestatic #43; //Method VBA/Interaction.MsgBoxError:(Ljava/lang/Ex
ception;)V
39: goto 29
42: astore_2
43: astore_1
44: ret 2
46: jsr 42
49: goto 31
Exception table:
from to target type
12 29 46 any
LineNumberTable:
line 4: 0
line 5: 4
line 6: 12
line 7: 17
line 8: 23
line 9: 29
LocalVariableTable:
Start Length Slot Name Signature
0 52 0 args [Ljava/lang/String;
0 52 1 Err Ljava/lang/Exception;
0 52 2 h3 Ljava/lang/Exception;
0 52 3 myArgs LVBA/VBArrayString;
public Module1();
Signature: ()V
Code:
0: aload_0
1: invokespecial #13; //Method java/lang/Object."<init>":()V
4: nop
5: return
LocalVariableTable:
Start Length Slot Name Signature
0 6 0 me LModule1;
public static {};
Signature: ()V
Code:
0: new #16; //class Form1
3: dup
4: invokespecial #17; //Method Form1."<init>":()V
7: putstatic #20; //Field Form1:LForm1;
10: nop
11: return
}
|
For information:
The parts with "LocalVariableTable" and "LineNumberTable" are Debug-code.
For example the LineNumberTable says, which Line number of the Sourcecode, you can find as representation on the Asseblercode.
Only needed for debugging.
Greatings
theuserbl
And here the code of Form1.class in the same way deassembalted:
It is shorter then Module1. But as you can see, there existing still "LocalVariableTable".
But Pack200 can remove it. :-)
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
javap -s -l -c Form1
Compiled from "Form1.jsrc"
public class Form1 extends VB.Form{
public Form1();
Signature: ()V
Code:
0: aload_0
1: invokespecial #9; //Method VB/Form."<init>":()V
4: aload_0
5: invokevirtual #12; //Method initVars:()V
8: nop
9: return
LocalVariableTable:
Start Length Slot Name Signature
0 10 0 me LForm1;
}
|
It is shorter then Module1. But as you can see, there existing still "LocalVariableTable".
But Pack200 can remove it. :-)
Similar threads
-
Tips, Tricks, Samples & Tutorials »-
How to use a simple debug class
(May 24th 2009, 12:33pm)
-
General topics, questions and discussions »-
Trying New Version
(Jul 1st 2009, 12:09am)
-
Tips, Tricks, Samples & Tutorials »-
How to use ActiveX controls with Jabaco
(Apr 29th 2009, 8:43pm)
-
General topics, questions and discussions »-
Deleting and item in a listbox
(Feb 27th 2009, 9:29pm)
