Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Including jar files during execution

 
Shane Roylance
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have incorporated some stuff for the Apache FO processor in my application. To build my application I include the jar files necessary for the apache stuff, and it builds fine. But during execution when I get to the point that calls the Apache stuff my application just hangs, I assume because it can't find it. I don't get any errors or exceptions. I know the jar files are in my classpath, and just to be sure I have explicity added each one to the classpath on the command line. What could be going on here?
One other note. I am using NetBeans as my IDE, and I can build and execute my application with no problem from netbeans. But outside of the IDE is where I run into these difficulties. Any help would be appreciated.
 
Joe Ess
Bartender
Pie
Posts: 9264
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Has to be something else. If the JVM couldn't find a .class file you would have received a "java.lang.NoClassDefFoundError".
 
Shane Roylance
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it turns out that I am getting an NoClassDefFoundError, why would it not be able to find the class at runtime? What am I doing wrong here?
 
Joe Ess
Bartender
Pie
Posts: 9264
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The java virtual machine searches a bunch of directories and archive files called the classpath to find all the classes it needs. If it does not find a class it needs, it throws the java.lang.NoClassDefFoundError. The JavaRanch FAQ has a good section on How To Set The Classpath. If your program is not throwing the above error your classpath should be good.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic