fvarrui / JavaPackager

:package: Gradle/Maven plugin to package Java applications as native Windows, MacOS, or Linux executables and create installers for them.
GNU General Public License v3.0
1.07k stars 134 forks source link

Portable binaries/executables #216

Open Osiris-Team opened 2 years ago

Osiris-Team commented 2 years ago

Some programs can be directly used by running the executable/binary, without needing to install them first using an installer. To have an option to enable this in JavaPackager would be awesome (aka generate additional portable executables/binaries).

fvarrui commented 2 years ago

Hi @Osiris-Team! JavaPackager is able to generate a ZIP (zipball) and TGZ (tarball) files with your app, so the user only has to extract the folder with the app, without installation. Try createZipball=true and/or createTarball=true options, and generateInstaller=false if you don't want installers.

Osiris-Team commented 2 years ago

Oh yeah thats nice. Isnt it possible to have it all inside an exe though?

fvarrui commented 2 years ago

Yes, there's a way, but it's not supported by JavaPackager (yet?).

You can create a self extract and run EXE file from a ZIP file using 7z SDK. Take a look at this article. Maybe you can automate the self-extract-and-run EXE generation using Maven, and we can add as a new JavaPackager feature.

EasyG0ing1 commented 2 years ago

@fvarrui - It looks like, based on the article that you linked, that the resulting .exe file merely extracts other files and then executes one of the extracted files - and if I have that wrong, please let me know - but if that is the case, is there no way to have a self-contained .exe file with all of the included java libraries and executables that somehow magically just bust out of the .exe into ram and then execute the runnable .jar file, without adding additional files to the directory where the .exe is located?

One potential issue with the mentioned solution could be unwanted 'litter' on the hard drive (or thumb drive) when an app is not closed down in a 'clean' fashion.

But again, if I'm misunderstanding how it all works, then just kick me and I'll fall in line. ☺

fvarrui commented 2 years ago

Hi @EasyG0ing1! Yes, I agree with you ... but I think that this unwanted "litter" is stored in a temp directory, so it should be removed by the OS sooner or later. I don't know another all-in-one EXE solution.

Osiris-Team commented 2 years ago

Does someone want to implement this feature?

fvarrui commented 2 years ago

Does someone want to implement this feature?

Do you want it?

Osiris-Team commented 2 years ago

Yeah why not. Could take a bit before I find some time though.

fvarrui commented 2 years ago

Sorry for the misunderstanding ... I mean if you really want this feature, I'll be happy to implement it.

Osiris-Team commented 2 years ago

Oh yess that would be awesome :)

EasyG0ing1 commented 2 years ago

I upvote this feature request. Totally self-contained exe's (aka "portable .exe's") would have enormous utility in the broader spectrum of software development.

fvarrui commented 2 years ago

Ok, I plan to add this feature in v1.7.0, with some other requested features. Thanks!

fvarrui commented 1 year ago

I'm researching about using warp to build portable executables for each platform. It looks good!

fvarrui commented 1 year ago

You can create a self extract and run EXE file from a ZIP file using 7z SDK. Take a look at this article. Maybe you can automate the self-extract-and-run EXE generation using Maven, and we can add as a new JavaPackager feature.

After several tests I didn't manage to build a portable EXE with 7z SDK, so I rule out this route for now.

EasyG0ing1 commented 1 year ago

@fvarrui

I'm researching about using warp to build portable executables for each platform. It looks good!

Warp reminds me of the IBM OS/2 days ... ;-)

It looks somewhat complicated, but it does look functional.

fvarrui commented 1 year ago

Warp reminds me of the IBM OS/2 days ... ;-)

I'm old enough to remember that too 😅