Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A minimal Stripped Down JRE for Windows

I have an application in the form of a jar file which is around 2MB in size. For several reasons, I have to bundle the JRE with my application. When I create an MSI with my jar and the JRE, the MSI size comes out to be around 30MB.

I am looking for a commercial or free JRE which I can bundle so that I can reduce the size of my MSI to as low as possible. I am looking at 5MB total, but even upto 10MB may be OK. Prebuilt JRE Binaries would be great, but not an absolute must.

I looked at similar questions posted here and here.

A lot of answers in these and other threads suggest Excelsior. I downloaded an evaluation version of Excelsior JET & Tried it out - for a few reasons, I think it may not be the right product for me.

1) Excelsior looks at reducing the footprint of the Installed Product not the Installer. I don't care much about the size of the Installed Product - I am mainly looking at a smaller download (the installer of my product currently at 30MB).

2) Amongst other things, Excelsior does lot of optimizations to code to achieve this - I don't want my jar file touched at all. I want a smaller JRE with my jar as is. There isn't a way to turn off some of the optimisations also.

3) Excelsior creates an EXE - I am not particularly looking for this - I am ok with my product being invoked via the javaw.exe command line.

So are there any suggestions for my need?

like image 208
user93353 Avatar asked Oct 18 '12 11:10

user93353


2 Answers

Avian and ProGuard are your friends as someone has already mentioned in one of the threads you linked to (it's the second comment btw).

From the Avian homepage:

The class library is designed to be as loosely coupled as possible, allowing tools like ProGuard to aggressively isolate the minimum code needed for an application. This translates to smaller downloads and faster startup.

Sounds like exactly what you need. And if that doesn't help you then look at the rest of the tools referenced in that thread.

like image 65
stackmagic Avatar answered Oct 13 '22 00:10

stackmagic


There is a possible solution here. Those tools install a minimalistic version of Java. I don't know if it is small enough for you. Just take a look and see: https://superuser.com/questions/745112/how-do-i-run-a-jar-file-without-installing-java

like image 38
Server Overflow Avatar answered Oct 13 '22 00:10

Server Overflow