JRE8 打包瘦身

最近接到一个考试软件的试用版,需要让用户下载到本地,解压后直接运行的。对于C#来说这都不是事,可以JAVA就惨了,JRE本身就180多M,让用户下载这么大个包,一定会被吐槽。于是要瘦身。


首先去这里下载一个javase8。之所以需要他,是因为他有个jrecreate的工具(bat和sh都有),可以按照压缩profile来整出不同的JRE瘦身版,包括compact1、2、3三个等级。compact1不到10M,但运行tomcat时出错,compact2才11M多,可正常运行tomcat并加载web应用。


http://www.oracle.com/technetwork/java/embedded/downloads/java-embedded-java-se-download-359230.html#javase8


Java SE 8 is the first Java release to incorporate JRE ‘profiles’, customized subsets of JRE libraries according to the needs of your app.
From the SE Embedded you need to create the JRE based on a selected profile and then copy it across to your device:
./bin/jrecreate.sh --help
./bin/jrecreate.sh--help
to get a list of the options (more noteshere).
To run the above on a Mac, you’ll need to set your JAVA_HOME first, assuming you already have an SE JDK installed. The Java install on Macs is different from other platforms, to handle having multiple versions installed. I have notes in a previous post on how to do thishere.
Create a compact1 profile jre with:
./bin/jrecreate.sh --dest jre8 -p compact1
./bin/jrecreate.sh--destjre8-pcompact1
Zip the created dir with
zip -r jre8.zip jre8/*
zip-rjre8.zipjre8/*
Scp it over to your target device, unzip and you’re ready to go!


附件是compact2的压缩版本


参考地址:
http://my.oschina.net/benhaile/blog/211804
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值