See Lesson: Packaging Programs in JAR Files (The Java™ Tutorials > Deployment)

Once you are familiar with doing this via the command line then, and only then, would I recommend relying on an IDE