Skip to content

Instantly share code, notes, and snippets.

@mahradbt
Created September 17, 2017 10:57
Show Gist options
  • Save mahradbt/f70ef585db85f78110ba518a7c378d2e to your computer and use it in GitHub Desktop.
Save mahradbt/f70ef585db85f78110ba518a7c378d2e to your computer and use it in GitHub Desktop.
script for simple java app create jar file on linux
#!/bin/bash
touch hello.java
echo 'class Hello{public static void main(String[] args){System.out.println("Hello World");}}' > hello.java
javac hello.java
touch MANIFEST.MF
echo "Main-Class: Hello" > MANIFEST.MF
jar cmfv MANIFEST.MF Hello.jar *.class
java -jar Hello.jar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment