Problem with DroidEx -

69 views
Skip to first unread message

Tony Khosravi

unread,
Jun 2, 2010, 8:20:05 PM6/2/10
to cw-android
Hello,

I am developing on Android only for a couple of months and I am
currently trying to get the screen of my Android device (HTC Hero with
Android 1.5). I run through the web and I fell on your DroidEx tool
which would have seem to be what I was looking for. I followed your
instructions given at : http://groups.google.com/group/android-discuss/browse_thread/thread/939b320cea3c81d4
but I am facing a problem and I don't really know how to solve it (I
am not really aware of the kind of error). I just cannot run the
DroidEx.jar because of the following error :

Exception in thread "main" java.lang.NoClassDefFoundError: org/kohsuke/
args4j/CmdLineException
Caused by: java.lang.ClassNotFoundException:
org.kohsuke.args4j.CmdLineException
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: com.commonsware.droidex.DroidEx.
Program will exit.

Here is the content of my droidex.cmd :

adb start-server
java -cp DroidEx.jar;libddmlib.jar com.commonsware.droidex.DroidEx
pause

I am running on Windows 7, using the last version of the Android SDK,
the r-6 version

Maybe the solution is not as difficulit as it seems to be to me but I
can't figure it out, so I hope that you will find it.

Thank you for you help
Best

Tony

Mark Murphy

unread,
Jun 2, 2010, 8:26:52 PM6/2/10
to cw-an...@googlegroups.com

Given what you have there, your middle line should look like:

java -cp DroidEx.jar;ddmlib.jar;args4j-2.0.16.jar
com.commonsware.droidex.DroidEx

(all on one line)

You are missing the args4j JAR file, found in the lib/ directory of the
GitHub repo. Put it in the same directory as your other two JARs, adjust
your droidex.cmd as shown above, and hope that it all works on Windows 7.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.1
Available!

Tony Khosravi

unread,
Jun 3, 2010, 9:48:31 AM6/3/10
to cw-android
Thank you for your answer. I have just tried your solution ,but I now
have another error, which I don't really understand as well.

Here is my new droidex.cmd :

adb start-server
java -cp bin/DroidEx.jar;C:/dev/android-sdk-windows/tools/
libddmlib.jar;lib/args4j-2.0.16.jar com.commonsware.droidex.DroidEx 2>
toto.txt
pause

And here is the error that is generated :

Exception in thread "main" java.lang.NoClassDefFoundError: com/android/
ddmlib/AndroidDebugBridge
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethod(Class.java:1935)
at java.awt.Component.isCoalesceEventsOverriden(Component.java:5948)
at java.awt.Component.access$500(Component.java:169)
at java.awt.Component$3.run(Component.java:5902)
at java.awt.Component$3.run(Component.java:5900)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Component.checkCoalescing(Component.java:5899)
at java.awt.Component.<init>(Component.java:5868)
at java.awt.Container.<init>(Container.java:251)
at java.awt.Window.<init>(Window.java:431)
at java.awt.Frame.<init>(Frame.java:403)
at java.awt.Frame.<init>(Frame.java:368)
at javax.swing.JFrame.<init>(JFrame.java:158)
at com.commonsware.droidex.DroidEx.<init>(DroidEx.java:44)
at com.commonsware.droidex.DroidEx.main(DroidEx.java:147)
Caused by: java.lang.ClassNotFoundException:
com.android.ddmlib.AndroidDebugBridge
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 17 more


Does the problem come from my ddmlib.jar or am I missing something
else?

Best

Tony



On 3 juin, 02:26, Mark Murphy <mmur...@commonsware.com> wrote:
> Tony Khosravi wrote:
> > I am developing on Android only for a couple of months and I am
> > currently trying to get the screen of my Android device (HTC Hero with
> > Android 1.5). I run through the web and I fell on yourDroidExtool
> > which would have seem to be what I was looking for. I followed your
> > instructions given at :  http://groups.google.com/group/android-discuss/browse_thread/thread/9...
> > but I am facing aproblemand I don't really know how to solve it (I
> > am not really aware of the kind of error). I just cannot run the
> >DroidEx.jar because of the following error :
>
> > Exception in thread "main" java.lang.NoClassDefFoundError: org/kohsuke/
> > args4j/CmdLineException
> > Caused by: java.lang.ClassNotFoundException:
> > org.kohsuke.args4j.CmdLineException
> >    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
> >    at java.security.AccessController.doPrivileged(Native Method)
> >    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
> >    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
> >    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> >    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
> > Could not find the main class: com.commonsware.droidex.DroidEx.
> > Program will exit.
>
> > Here is the content of mydroidex.cmd :
>
> > adb start-server
> > java -cpDroidEx.jar;libddmlib.jar com.commonsware.droidex.DroidEx
> > pause
>
> Given what you have there, your middle line should look like:
>
> java -cpDroidEx.jar;ddmlib.jar;args4j-2.0.16.jar
> com.commonsware.droidex.DroidEx
>
> (all on one line)
>
> You are missing the args4j JAR file, found in the lib/ directory of the
> GitHub repo. Put it in the same directory as your other two JARs, adjust
> yourdroidex.cmd as shown above, and hope that it all works on Windows 7.
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

Mark Murphy

unread,
Jun 3, 2010, 4:51:44 PM6/3/10
to cw-an...@googlegroups.com

Yes, the class it is looking for would ordinarily reside in ddmlib.jar.

Note that I have not tried DroidEx on Android 2.2 yet, nor on Windows 7
ever.

--

Tony Khosravi

unread,
Jun 4, 2010, 5:34:28 AM6/4/10
to cw-android
Thank you for your answer. I have just figured out what was the
problem of my last script.

I had :
adb start-server
java -cp bin/DroidEx.jar;C:/dev/android-sdk-windows/tools/
libddmlib.jar;lib/args4j-2.0.16.jar com.commonsware.droidex.DroidEx
pause

instead of :
adb start-server
java -cp bin/DroidEx.jar;C:/dev/android-sdk-windows/tools/
lib/ddmlib.jar;lib/args4j-2.0.16.jar com.commonsware.droidex.DroidEx
pause

The difference is the '/' between 'lib' and 'ddmslib.jar', just a
stupid mistake from me.
It works pretty well now.

Thank you for your efforts to answer me and for this little
application quite useful.

Best

Tony
> Note that I have not triedDroidExon Android 2.2 yet, nor on Windows 7
> ever.
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
Reply all
Reply to author
Forward
0 new messages