How to quickly create .JAR files for testing

  1. Make bunch of files like this:

    public class helloW1 {

    public static void main(String[] args) {
    // Prints “Hello, World” to the terminal window.
    System.out.println(“Hello, World -1”);
    }
    }

  2. Compile the files:

    javac helloW1.java

  3. Creating some manifest file to create the JAR, extension should be .txt

    Main-Class: helloW1

  4. Create the JAR file using the code:

    jar cfm helloW1.jar helloW1.txt helloW1.class

  5. (To run!)

    java -jar helloW1.jar

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s