javaeclipsejareclipse-3.4ganymede

Where to put the external jars?


I use Eclipse (3.4) and my class compiles without warning or errors. My project uses an external jar file.

Where do I need to put this external jar file in order not to get a java.lang.NoClassDefFoundError when using this class from another project (not in Eclipse)?

I could just extract the jar into the project folder, but that does not feel right.

Edit: this question is not about importing jars in Eclipse, but using them outside of Eclipse.


Solution

  • If you're wanting to include a JAR file to your Eclipse project, you would generally create a lib folder inside the project folder and put the file in there. You then need to tell Eclipse to include it in your class path so your code will compile and run inside Eclipse.

    To do that:

    Your code will now compile and run.