This week's book giveaway is in the Other Languages forum. We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line! See this thread for details.
class not found in Eclipse-built external jar, but found in Netbeans-built one
posted 4 years ago
I am new to Android development and fairly new to Java altogether. I am trying to develop an Android app that uses some classes from an external JAR. I've run into a strange problem. I managed to reduce the amount of code to "toy" sizes and so now the external JAR is extremely simple: it contains a class that computes a square of a number and returns the result as a String:
The code of the app is basically "Hellow world++" based on the 1st app in the Android dev tutorial:
Now, here's the problem. I am developing for Android in Eclipse. However, if I also create the JAR in Eclipse by creating a regular Java project with the class, then exporting it into a jar file, and then add this JAR to the build path of the Android project, I get a run time exception that this class cannot be found.
If, on the other hand, I create the JAR in Netbeans and add that JAR to the build path (in Eclipse), all works well.
I actually unzipped both jars to compare contents. It appears that the difference is in .class files but they are not human readable so I can't get any further.
So my q is this: what can I change in the Eclipse export to make the external jar "good"? What is NB doing right that Eclipse is doing wrong? Or do I simply resort to building all my external JARs in NB? Is this a symptom of a badly installed Eclipse? If so, what components should I try to reinstall/fix?