Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / September 2005

Tip: Looking for answers? Try searching our database.

command to view contents of a class...

Thread view: 
Frances - 12 Sep 2005 14:23 GMT
pls, what's command in shell to view src code of a compiled class?  I
have a class that's giving me an extra ("__$1.class") when I compile,
even though I don't have any inner classes inside class...  I would like
to know what's inside this __$1.class...  thank you..
Frances
Tor Iver Wilhelmsen - 12 Sep 2005 15:48 GMT
> pls, what's command in shell to view src code of a compiled class?  I
> have a class that's giving me an extra ("__$1.class") when I compile,
> even though I don't have any inner classes inside class...  I would
> like to know what's inside this __$1.class...  thank you..
> Frances

Do you have any code like

addActionListener(new ActionListener() {
 ...
});

The $1 etc. classes are synthesized nested anonymous classes generated
from stuff like that. But they can be hard to notice sometimes simply
because they're "inline" in the source code.

Other than that, try e.g.

javap -c -classpath whatever __.1

to disassemble it.
Frances - 12 Sep 2005 17:23 GMT
>>pls, what's command in shell to view src code of a compiled class?  I
>>have a class that's giving me an extra ("__$1.class") when I compile,
[quoted text clipped - 17 lines]
>
> to disassemble it.

Thank you very much..  no, I don't have the ActionListener code you
mention.. but I do have this:

public void start() {
    SwingUtilities.invokeLater(new Runnable() {
         public void run() {

I think this is what's doing it..  (this is for a signed applet, and on
this '$' class get error that "__$1's signer's ID is wrong" or something
like that, when in fact this class is signed (and jarred) the same as
other classes..)  also get a thread error..   (I don't get threads,
threads are driving me nuts..)

thanks again..  Frances
Roedy Green - 12 Sep 2005 21:18 GMT
>public void start() {
>    SwingUtilities.invokeLater(new Runnable() {
>         public void run() {

this defines a new class without a name that implements Runnable with
a run method defined in a new way.  Since it has not get a name, Javac
makes one up e.g. $1
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Roedy Green - 12 Sep 2005 21:17 GMT
>pls, what's command in shell to view src code of a compiled class?  I
>have a class that's giving me an extra ("__$1.class") when I compile,
>even though I don't have any inner classes inside class...  I would like
>to know what's inside this __$1.class...  thank you..
>Frances

you want a decompiler or disassembler. See
http://mindprod.com/jgloss/decompiler.html
http://mindprod.com/disassembler.html

When you peek, you will discover that code is for anonymous inner
classes.

See http://mindprod.com/jgloss/nestedclasses.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.