Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

class not found in Eclipse-built external jar, but found in Netbeans-built one

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Thanks much!!!
You are HERE! The other map is obviously wrong. Better confirm with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic