I have a NetBeans project that relies on one specific Java class in another project. Right now, when NetBeans compiles the project, it only adds a reference to the other Java class, which leads to a NoClassDefFoundError since the external class isn’t in the JAR.
How can I force NetBeans to compile that external file into the JAR when it builds, short of copying and pasting it over?
I take it that you are trying to create what it commonly known as a “fat JAR file”; i.e. a JAR file that contains all required classes for your application.
Try the recipe in this forum posting.
Another alternative might be to add something like the following to your Ant
buld.xmlfile.