hello everyone, is there any tool class or utilities class in java class library that can run/view .class file?. for example if i click a jbutton i can view a .class file.. Please help. thanks.

Recommended Answers

All 2 Replies

You can view a .class file like any other file: By opening it. Use whatever program you want to open it. But don't expect to see anything. Here is a sample of what a .class file looks like when I used PSPad:

CAFE BABE 0000 0031 0112 0A00 4E00 B409
002C 00B5 0900 2C00 B609 002C 00B7 0900
2C00 B809 002C 00B9 0900 2C00 BA09 002C
00BB 0900 2C00 BC09 002C 00BD 0A00 2C00
BE0A 002C 00BF 0A00 2C00 C00A 002C 00C1
0A00 2C00 C20A 002C 00C3 0A00 2C00 C40A
002C 00C5 0A00 2C00 C60A 002C 00C7 0700
C808 00C9 0A00 1500 CA08 00CB 0800 CC08
00CD 0800 CE0A 0027 00CF 0800 D00A 0027

As you can see it is binary code. Actually what you see is hex code (0,1,2,3,4,5,6,7,8,9,A,B, C,D,E,F) because this is how PSPad displays it, but in reality it is binary

commented: I think he meant reverse-engineering, but that does answer the question! =) +4

hello everyone, is there any tool class or utilities class in java class library that can run/view .class file?. for example if i click a jbutton i can view a .class file.. Please help. thanks.

read your classnotes again, and check what a .class file actually is.
it's just the compiled version of your .java file

if you know how to read, edit and run your .java files, you know all you need to know about that.

in order to run: java MyApplication.java

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.