Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (289)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  post your class compression scripts / squences  (Read 1969 times)
0 Members and 1 Guest are viewing this topic.
Online moogie

JGO Knight


Medals: 7
Projects: 5


Java games rock!


« Posted 2006-02-06 13:37:11 »

I have a batch file which does the following:

run the class through Proguard
and then through Jarg (Jogl actually breaks my class so i cannot use it Sad )

This resultant class is then 'packed' and then 'unpacked' creating a class file which is even more compressable.

I then zip the final class file through different programs and settings (7zip, kzip and bwflate) and choose the best. (usually the bwflate zipped one is best)

Currently this brings the jar file down from 8,707 bytes when jar-ed using normal zip compression to 4,266 bytes (still need to optimize the code some more.)


my script (not easily transferable to other people's computers but you get the gist of it:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
del D:\eclipse\workspace\rally4k\basic.jar
mkdir D:\eclipse\workspace\rally4k\compressed
cd D:\eclipse\workspace\rally4k\compressed
d:
del *.* /Q
"D:\Program Files\7-Zip\7z.exe" a -tzip D:\eclipse\workspace\rally4k\basic.jar D:\eclipse\workspace\rally4k\Rally4k.class
java -jar D:\downloads\proguard3.5\proguard3.5\lib\proguard.jar @D:\eclipse\workspace\rally4k\settings.pro
java -jar D:\downloads\jarg-0.9.14\jarg.jar -main Rally4k D:\eclipse\workspace\rally4k\compressed\Rally4k_PG.jar

"D:\Program Files\7-Zip\7z.exe" x D:\eclipse\workspace\rally4k\compressed\Rally4k_PG_s.jar -oD:\eclipse\workspace\rally4k\compressed\

ren D:\eclipse\workspace\rally4k\compressed\Rally4k.class Rally4K.class.pre-pack&unpack

"C:\Program Files\Java\jdk1.5.0_04\bin\pack200.exe" --no-gzip D:\eclipse\workspace\rally4k\compressed\Rally4k.jar.pack D:\eclipse\workspace\rally4k\compressed\Rally4k_PG_s.jar

"C:\Program Files\Java\jdk1.5.0_04\bin\unpack200.exe" D:\eclipse\workspace\rally4k\compressed\Rally4k.jar.pack D:\eclipse\workspace\rally4k\compressed\Rally4k.jar.pack.unpacked.jar

"D:\Program Files\7-Zip\7z.exe" x D:\eclipse\workspace\rally4k\compressed\Rally4k.jar.pack.unpacked.jar -oD:\eclipse\workspace\rally4k\compressed\

"D:\Program Files\7-Zip\7z.exe" a -tzip D:\eclipse\workspace\rally4k\compressed\Rally4k_7z.jar D:\eclipse\workspace\rally4k\compressed\Rally4k.class -mx9 -mfb=255 -mpass=4

D:\downloads\kzip.exe /v /b64 D:\eclipse\workspace\rally4k\compressed\Rally4k.class(64).jar D:\eclipse\workspace\rally4k\compressed\Rally4k.class

D:\downloads\kzip.exe /v /b128 D:\eclipse\workspace\rally4k\compressed\Rally4k.class(128).jar D:\eclipse\workspace\rally4k\compressed\Rally4k.class

D:\downloads\kzip.exe /v /b256 D:\eclipse\workspace\rally4k\compressed\Rally4k.class(256).jar D:\eclipse\workspace\rally4k\compressed\Rally4k.class

D:\downloads\kzip.exe /v /b512 D:\eclipse\workspace\rally4k\compressed\Rally4k.class(512).jar D:\eclipse\workspace\rally4k\compressed\Rally4k.class

D:\downloads\kzip.exe /v /b1024 D:\eclipse\workspace\rally4k\compressed\Rally4k.class(1024).jar D:\eclipse\workspace\rally4k\compressed\Rally4k.class

D:\downloads\BJWFlate154\BJWFlate.exe -a -n D:\eclipse\workspace\rally4k\compressed\Rally4k.class.BWflate(120).jar D:\eclipse\workspace\rally4k\compressed\Rally4k.class

D:\downloads\BJWFlate154\BJWFlate.exe -a -n -s4096 D:\eclipse\workspace\rally4k\compressed\Rally4k.class.BWflate(4096).jar D:\eclipse\workspace\rally4k\compressed\Rally4k.class

D:\downloads\BJWFlate154\BJWFlate.exe -a -n -s8192 D:\eclipse\workspace\rally4k\compressed\Rally4k.class.BWflate(8192).jar D:\eclipse\workspace\rally4k\compressed\Rally4k.class
Online Riven
« League of Dukes »

JGO Overlord


Medals: 437
Projects: 4


Hand over your head.


« Reply #1 - Posted 2006-02-06 13:40:18 »

 Shocked Kiss

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Projects: Revenge of the Titans, Titan Attacks, Droid Assault, and Ultratron
Offline DonaldEKnuth

Junior Member





« Reply #2 - Posted 2006-02-06 16:45:41 »

Are you using the latest version of KZip?

My 4k 2006 Entry: Sokoban4k
Games published by our own members! Check 'em out!
Try the Free Demo of Titan Attacks
Online moogie

JGO Knight


Medals: 7
Projects: 5


Java games rock!


« Reply #3 - Posted 2006-02-06 22:22:54 »

Are you using the latest version of KZip?

I am using the version Compiled: Nov 23 2005
Offline DonaldEKnuth

Junior Member





« Reply #4 - Posted 2006-02-07 02:08:59 »

Quote
I am using the version Compiled: Nov 23 2005
Interesting, where would I get bwflate? And if you know, what's its trick for reaching such a good result?

My 4k 2006 Entry: Sokoban4k
Online moogie

JGO Knight


Medals: 7
Projects: 5


Java games rock!


« Reply #5 - Posted 2006-02-07 03:20:37 »

http://www.clrmame.com/bjwflate.htm

It does into details about how it achieves it's good result, but better than i could explain Smiley

The best trick I have been able to research is the pack200 -> upack200 step after both obfustcators. I makes the class files much more compressable.

However, i am not entirely sure whether the resultant class file is 1.4.2 compatible. Does anyone know a way to test this with out  installing 1.4.2 jre?
Offline nonnus29

Senior Member




Giving Java a second chance after ludumdare fiasco


« Reply #6 - Posted 2006-02-07 03:50:47 »

kzip -> proguard -> jarg -> 7zip unjar -> 7zip jar

I went from 3.46kb to 2.99.

 Shocked

That's too good to be true....

Edit; oops it was; I failed to specify zip file format.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (60 views)
2013-05-17 21:29:12

alaslipknot (69 views)
2013-05-16 21:24:48

gouessej (99 views)
2013-05-16 00:53:38

gouessej (96 views)
2013-05-16 00:17:58

theagentd (107 views)
2013-05-15 15:01:13

theagentd (98 views)
2013-05-15 15:00:54

StreetDoggy (144 views)
2013-05-14 15:56:26

kutucuk (166 views)
2013-05-12 17:10:36

kutucuk (165 views)
2013-05-12 15:36:09

UnluckyDevil (175 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.267 seconds with 22 queries.