15

When I write in command line javap -s java.awt.Label, I succesfully get signatures for Label. Now I want to get signatures for Android Activity class. But if I write javap -s android.app.activity it results in ERROR: Could not find android.app.activity.

What am I doing wrong? Should I change something in PATH env var or whatever?

Nick
  • 3,205
  • 9
  • 57
  • 108
  • You should call it on the class--or is that a typo? – Dave Newton May 29 '13 at 17:23
  • @Dave Newton Er... Activity is a class as far as I know. How do I change my cmdline request to get Activity method signatures? – Nick May 29 '13 at 17:28
  • Er.... `android.app.activity` isn't. `android.app.Activity` is. And the ADK classes have to be on your classpath; I can't tell from here if they are or not. (If javap even works on them; not sure when/how things are lunk and/or dexxed.) And `PATH` is not related to `CLASSPATH` (and in general I prefer `-cp` anyway, to avoid issues.) – Dave Newton May 29 '13 at 17:28
  • @Dave Newton `javap -s android.app.Activity` did not help either. – Nick May 29 '13 at 17:29
  • @Dave Newton Thank you for your answers. Where is classpath set so that `javap` could find it? – Nick May 29 '13 at 17:32
  • Via `CLASSPATH` or `-cp`? – Dave Newton May 29 '13 at 17:33
  • @Dave Newton Thanks! I ended up with `javap -s -classpath android.jar android.app.Activity` – Nick May 29 '13 at 17:44

1 Answers1

19

Go to your apps directory and

javap -s -classpath bin/classes com.example.myActivity

Edit

for Android core classes add bootclasspath

javap -s -bootclasspath /opt/android-sdk/platforms/android-8/android.jar -classpath bin/classes android.app.Activity
j.holetzeck
  • 4,048
  • 2
  • 21
  • 29
  • Thanks :) Why not just add it to the classpath, though? – Dave Newton May 29 '13 at 19:03
  • @Dave Newton: Actually I work from within Eclipse and have projects targeting different Android versions (different android-X/android.jar files), so I have no CLASSPATH set manually anywhere. – j.holetzeck May 29 '13 at 19:13
  • I'll be more explicit: why not just add it to the `-classpath` parameter? – Dave Newton May 29 '13 at 19:16
  • @Dave Newton: no real reason :) – j.holetzeck May 29 '13 at 19:27
  • @Dave Newton: Interestingly it really makes a difference as `rt.jar` and `android.jar` are different: `javap -s -classpath /opt/android-sdk/platforms/android-8/android.jar:bin/classes java.lang.System` contains `getCallerClass()` and `javap -s -bootclasspath /opt/android-sdk/platforms/android-8/android.jar -classpath bin/classes java.lang.System` does not ... – j.holetzeck May 29 '13 at 19:48
  • ... but only for OpenJDK as it seems. – j.holetzeck May 29 '13 at 19:56