• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps NullPointerException when .jar file is used

I have an old java application in package "va" and created .jar file from it. While creating the .jar file, I gave the command from outside the va folder (containing classes). When I use the .jar file in another Java application on my desktop, giving java -jar command, it is working fine.
I am creating my first android app and I have placed va.jar in the lib folder and added it as a library. The android app is creating an object of a class (this class contains main method also) in this va package. I have imported va.* and the android app is compiling without any errors.
Here is the code

import va.*;

-------

VarAnalyser obj = new VarAnalyser(); // it is ok up to this point

obj.init(); // null pointer exception

When I execute this on emulater, I am getting NullPointerException on this line.

I created one more app by putting all the .java files of the package "va", and it is working without throwing exception.
How to solve this problem? I want to keep only the .jar file and not the source code of package va.
Thanks in advance.
 
Back
Top Bottom