Executable jar through jar update

Stopgap rather than real solution but here it goes:

jar -ufe jarName.jar packageName/className

Why it works? It updates the jar in place, stating that entry point will be class in given package.

Update -> u.
Entry point -> e.
File to be operated on set to output file -> f.
Lastly, package can be specified with a dot (.) or a slash (/) -> packageName.ClassName || packageName/ClassName

Next time when you want to just launch a Maven app without looking for best way to have executable jar in Maven (shader, assembly, exec, manifest hand editing, many, many others) consider just updating the JAR file with jar -ufe jarName.jar package/Class.


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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s