2

How does one use java.util.jar.JarOutputStream to create a jar file on button press? This new jar file, I want to make it runnable so it performs a specific action on run...

Anyone know how I can accomplish this?

Thanks

rshah
  • 675
  • 2
  • 12
  • 32

1 Answers1

0

I managed to do this following this example:

https://stackoverflow.com/a/1281295/3474870

However it was only creating a simple output jar file.. What I needed was a runnable jar file.

I realised that the manifest set what the file did, so I took a look at the possible attributes and found this:

manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, new RunnableJarClass());

This enabled me to create the jar file, but use tell the manifest to look for the main method!

Hope this helps :)

Community
  • 1
  • 1
rshah
  • 675
  • 2
  • 12
  • 32