Including .jar files in a classpath (Eclipse)

Hey guys, a very noob question.

I usually cheat and put .jar files in my Java Extensions folder, which works fine aside from version issues and exporting a product to other people. I never bothered to learn the correct way to do this. In Eclipse, if I drag the .jar into the Package Explorer, it works fine while using the Run… menu, but if I export a .jar I have problems with the inclusion. The classpath when in the package explorer should be the same directory, but even when I export a .jar and include the used .jar library in the same folder, it does not work correctly.

How exactly can I bundle .jar libraries into an exported .jar application.

Demonpants, it’s still early for me ;), but I think I understand your problem.
You should make a manifest file by yourself and tell eclipse that you have one when building .jar (export). Manifest should look something like this:

Manifest-Version: 1.0
Class-Path: lwjgl.jar lwjgl_devil.jar lwjgl_util.jar anyexternalJar.jar ... (this should be in the same dir)
Main-Class: (your main class   package.MainClass)

hope it helps …

Ah, good idea. I’ll try that. Thanks hvor.

I think it may also be possible to tell the jar packager to actually include the neede classes from your library jar oin the single application jar…

Yeah, that’s what I’ve wanted to do.

Mac OS X has a .app bundler which let’s you do that, but I don’t have the option for PC. I’ll look around.

Genjar allows you to do this.

… actually, I’m not sure if you can include only some files from a library jar in the output jar, but it certainly allows you to incorporate everything into one jar.

Ooh, Genjar looks great. Thanks a lot.