• Post Reply Bookmark Topic Watch Topic
  • New Topic

[newbie] javap ERROR:Could not find TalkingClock$1TimePrinter.class  RSS feed

 
Jon Camilleri
Ranch Hand
Posts: 664
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to use the following commands:

C:\Users\Administrator\Desktop\Java_console>dir
Volume in drive C has no label.
Volume Serial Number is 982D-F9F4

Directory of C:\Users\Administrator\Desktop\Java_console

05/21/2009 05:29 PM <DIR> .
05/21/2009 05:29 PM <DIR> ..
05/08/2009 02:00 PM 41 cleanup.bat
05/11/2009 06:43 PM 1,797 Command Prompt.lnk
05/21/2009 05:24 PM 1,459 TalkingClock - Copy.java
05/21/2009 05:29 PM 1,714 TalkingClock$1TimePrinter.class
05/21/2009 05:29 PM 1,172 TalkingClock.class
05/21/2009 04:51 PM 1,378 TalkingClock.java
05/21/2009 04:23 PM 665 Test.java
7 File(s) 8,226 bytes
2 Dir(s) 50,245,124,096 bytes free

C:\Users\Administrator\Desktop\Java_console>javap -p TalkingClock.class
ERROR:Could not find TalkingClock.class

C:\Users\Administrator\Desktop\Java_console>javap -p TalkingClock$1TimePrinter.c
lass
ERROR:Could not find TalkingClock$1TimePrinter.class

C:\Users\Administrator\Desktop\Java_console>echo %CLASSPATH%
C:\Users\Administrator\Desktop\Java_console

C:\Users\Administrator\Desktop\Java_console>javap -p TalkingClock\$TimePrinter
ERROR:Could not find TalkingClock\$TimePrinter

C:\Users\Administrator\Desktop\Java_console>


 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suspect that is the same problem as your other compiling error. Go through the directory you have the .class files in and see how many actually exist.

By the way: $1TimePrinter is a very unusual name for a class. Is it an anonymous class?
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javap doesn't have a -p option as far as i can see. Did you mean to use -c
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By the way, when you use javap, you don't write ".class".
 
Jon Camilleri
Ranch Hand
Posts: 664
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:I suspect that is the same problem as your other compiling error. Go through the directory you have the .class files in and see how many actually exist.
There are two files:
TalkingClock.class (now compiled without the package)
TalkingClock$1TimePrinter.class (an inner class)

By the way: $1TimePrinter is a very unusual name for a class. Is it an anonymous class?

Yes

 
Jon Camilleri
Ranch Hand
Posts: 664
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joanne Neal wrote:javap doesn't have a -p option as far as i can see. Did you mean to use -c


Ooops...

I meant javap -private TalkingClock


 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jon Camilleri wrote:
Joanne Neal wrote:javap doesn't have a -p option as far as i can see. Did you mean to use -c


Ooops...

I meant javap -private TalkingClock




OK. So is it working now or are you still getting errors ?
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please use the buttons to add tags; it is quicker than writing them yourself.

No, you aren't using an anonymous class. It is an inner class. This might help show its details:

[Campbell@localhost time]$ javap -c TalkingClock$1
 
Jon Camilleri
Ranch Hand
Posts: 664
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Please use the buttons to add tags; it is quicker than writing them yourself.

No, you aren't using an anonymous class. It is an inner class. This might help show its details:

[Campbell@localhost time]$ javap -c TalkingClock$1


Indeed thanks.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!