I want to develop a program using the Java MSN Messenger library (JML). I can not solve a problem where the following exeception is thrown.
ERROR/AndroidRuntime(312): FATAL EXCEPTION: Thread-21
**ERROR/AndroidRuntime(312): java.lang.ExceptionInInitializerError
ERROR/AndroidRuntime(312): at net.sf.jml.protocol.incoming.IncomingUSR$1.getLoginTicket(IncomingUSR.java:198)
ERROR/AndroidRuntime(312): at net.sf.jml.protocol.incoming.IncomingUSR$1.run(IncomingUSR.java:247)
ERROR/AndroidRuntime(312): Caused by: java.lang.NoClassDefFoundError: sun.security.action.Get开发者_运维问答PropertyAction
ERROR/AndroidRuntime(312): at net.sf.jml.util.StringUtils.<clinit>(StringUtils.java:58)
ERROR/AndroidRuntime(312):
... 2 more**
How to fix it?
You are trying to use Java MSN Messenger library. This library was created for J2SE/J2EE and can not be used on Android.
As you can see net.sf.jml.util.StringUtils is referencing sun.security.action.GetPropertyAction which is not available on Android.
I find a solution, i hope this can help to someone.
You must to recompile jml with a little change in net.sf.jml.util.StringUtils.java
1º Download the code of jml here:
http://sourceforge.net/projects/java-jml/files/java-jml/jml-1.0b4/
2º And then apply this patch
http://sourceforge.net/tracker/?func=detail&aid=2910514&group_id=118829&atid=682291
(i recomend download the code with a svn program and then aply the patch with tolstoi or other svn program )
When you have the code parched, create a .jar (right click in the project / export ) and then add this .jar to your msn project.
(solution based in : http://sourceforge.net/projects/java-jml/forums/forum/405891/topic/4093769 )
精彩评论