开发者

problem trying to use java mail API

开发者 https://www.devze.com 2023-02-27 09:40 出处:网络
I am trying to use the java Mail API in my program, i have the library added to my package folder but when i go to run the program it says that it cant find class javax.mail.internet.InternetAddress b

I am trying to use the java Mail API in my program, i have the library added to my package folder but when i go to run the program it says that it cant find class javax.mail.internet.InternetAddress but when i open the library i can see the class file there...so what gives?

04-21 10:30:25.202: ERROR/dalvikvm(3065): Could not find class 'javax.mail.internet.InternetAddress', referenced from method com.app.notifyme.GmailReciever.createNotification
04-21 10:30:30.632: ERROR/AndroidRuntime(3065): FATAL EXCEPTION: main
04-21 10:30:30.632: ERROR/AndroidRuntime(3065): java.lang.VerifyError: com.app.notifyme.GmailReciever
04-21 10:30:30.632: ERROR/AndroidRuntime(3065):     at java.lang.Class.newInstanceImpl(Native Method)
04-21 10:30:30.632: ERROR/AndroidRuntime(3065):     at java.lang.Class.newInstance(Class.java:1409)
04-21 10:30:30.632: ERROR/AndroidRuntime(3065):     at android.app.ActivityThread.handleReceiver(ActivityThread.java:1885)
04-21 10:30:30.632: ERROR/AndroidRuntime(3065):     at android.app.ActivityThread.access$2400(ActivityThread.java:123)
04-21 10:30:30.632: ERROR/AndroidRuntime(3065):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:989)
04-21 10:30:30.632: ERROR/AndroidRuntime(3065):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-21 10:30:30.632: ERROR/AndroidRuntime(3065):     at android.os.Looper.loop(Looper.java:123)
04-21 10:30:30.632: ERROR/AndroidRuntime(3065):     at android.app.ActivityThread.main(ActivityThread.java:3839)
04-21 10:30:30.632: ERROR/AndroidRuntime(3065):     at java.lang.reflect.Method.invokeNative(Native Method)
04-21 10:30:30.6开发者_开发问答32: ERROR/AndroidRuntime(3065):     at java.lang.reflect.Method.invoke(Method.java:507)
04-21 10:30:30.632: ERROR/AndroidRuntime(3065):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
04-21 10:30:30.632: ERROR/AndroidRuntime(3065):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
04-21 10:30:30.632: ERROR/AndroidRuntime(3065):     at dalvik.system.NativeStart.main(Native Method)


My guess is that you're missing the Activation API (usually called activation.jar), which is a dependency of JavaMail. If you don't have it, you'll get confusing classloading exceptions like this one.

activation.jar is usually found alongside mail.jar.

P.S. Fir future reference, if you want to ask about an exception on Stackoverflow, then show us the exception.


A nifty site is jarFinder. When I put your above class in it, jarFinder lists 14 versions in 110 different jar packages.

The big question is whether you have any of those jars in your classpath. I'm thinking you will need to add it with a set classpath command.

0

精彩评论

暂无评论...
验证码 换一张
取 消