Skip to content

Instantly share code, notes, and snippets.

@shanenoi
Created August 18, 2020 10:26
Show Gist options
  • Save shanenoi/02784beed5c7d9055fa2510e7d77e097 to your computer and use it in GitHub Desktop.
Save shanenoi/02784beed5c7d9055fa2510e7d77e097 to your computer and use it in GitHub Desktop.
Tìm hiểu Java khá lâu rồi nay mới biết cách build file jar bằng command :)
FILE=hello_world
CONTENT=$(cat <<-END
public class $FILE {
public static void main(String[] args) {
System.out.println(
"Excuse me, what the fuck!\\\n" +
"U dont know how to build jar by command?"
);
}
}
END
)
printf "${CONTENT}" >$FILE.java
javac $FILE.java
printf "Main-Class: ${FILE}\n" >manifest
jar cfm $FILE.jar manifest $FILE.class
rm $FILE.java \
$FILE.class \
manifest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment