How to compile runnable jar from packages?

First of all, consider using Ant for such a task.

First of all, consider using Ant for such a task. But since you asked for a manual process, you need to first create a manifest file, like so: Manifest-Version: 1.0 Created-By: 1.6.0 (Sun Microsystems Inc. ) Class-Path: lib/jdbc.

Jar lib/otherlib. Jar Main-Class: com.name.app. MainClass Replace the contents of Class-Path with your libs, and Main-Class with the fully qualified name of your main class.

Then, you need to generate the actual . Jar, using the following command: jar cfm app. Jar MANIFEST.

MF src/com/name/app/*. Class src/com/name/app/do/*. Class Where MANIFEST.

MF is the previously mentioned manifest file, and the rest is the folders where your . Java classes lie in. Finally, to run your app, you simply execute: java -jar app.jar.

Thanks a lot. This is exactly what I was looking for but considering you, Rob and the rest of the responders have suggested Ant I'll see if I can set it up this weekend. – John Mar 27 '10 at 10:59 Yes, it is much more simpler, and platform-independent : ).

– João Mar 27 '10 at 12:13.

Take a look at Ant. It's a relatively simple build tool to understand, and provides everything that meets your requirements. Here's a quick skeleton build.

Xml to get you started: You need to create a manifest file that will tell the java process which class holds the "main" method. Here is a good place to start learning about manifests. As an alternate that produces really cluttered Ant build files, you can right click on your Eclipse project and choose "Export...", then choose "General > Ant Buildfiles".

Anyway, that should get you started. You can ask more specific questions as you run into them.

Thanks! I'll definitely look in to Ant. – John Mar 27 '10 at 10:57.

Consider using Ant to do this. ant.apache.org.

I recommend that you use Apache Ant to implement your build scripts. If implemented correctly, Ant is easy to use and the build scripts can be run on any platform that you can install a JDK on. Indeed, with a little bit of work, you can even set up your project so that users don't even need to download / install Ant.(nt: add the Ant JAR files and a wrapper script to your project distro).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions