Finally, and thanks to the comments of Bonbon-Chan, Groboclown, Damocles, SimonH and Bainit, I have reconstructed a complete compression chain similar in results to Riven's Compile and shrink service. Of course, unlike with this last, you have to do everything yourself !
To start, here are some informations about my operating system and the software I used :
Windows 7 Home Premium - Service Pack 1
Java(TM) SE development Kit 6 Update 29 ( Windows x86 )
Proguard 4.6
Kzip compiled on 2007/04/14 ( latest release for what I know )
Zip2Gzip ( pjt33's awesome converter )
And here is the comparison between Compile and shrink's log and my own results :
a.java => 24352 bytes C'n s / 24352 bytes StephR
a.class => 9625 bytes C'n s / 9625 bytes StephR
a.normal.java6.jar => 5194 bytes C'n s / 5199 bytes StephR
a.normal.java6.pack => 7978 bytes C'n s / 7978 bytes StephR
a.progrd.java6.jar => 5104 bytes C'n s / 5104 bytes StephR
a.progrd.java6.pack => 7878 bytes C'n s / 7878 bytes StephR
a.progrd.java6.kz.pack.gz => 4058 bytes C'n s / 4054 bytes StephR
a.normal.java6.kz.pack.gz => 4078 bytes C'n s / not evaluated
a.progrd.java6.bj.pack.gz => 4086 bytes C'n s / not evaluated
a.progrd.java6.7z.pack.gz => 4280 bytes C'n s / not evaluated
a.normal.java6.7z.pack.gz => 4302 bytes C'n s / not evaluated
In the following lines, you will find the processes for the complete compression chain :
STEP 1 : JAVAC ( from java file )
Input file : a.java => 24352 bytes
Command line>javac -target 1.5 -g:none a.java
Output file : a.class => 9625 bytes ( C'n s: 9625 )
STEP 2 : JAR
Input file : a.class
Command line>jar cfM a.normal.java6.jar a.class
Output file : a.normal.java6.jar => 5199 bytes ( C'n s: 5194 )
STEP 3: PROGUARD
Launch proguardgui.bat from Windows.
*Page Input/Output
Input file : a.normal.java6.jar
Output file : a.progrd.java6.jar
*Page Shrinking
Options
X Shrinking
Keep
X Applets
Also keep
none
*Page Obfuscation
Options
X Obfuscate
X Overload aggressively
Keep names
none
*Page Optimization
Options
X Optimize
X Allow access modification
9 Optimisation passes
Remove
all
Remove debugging
all
*Page Information
default settings
*Page Process
hit Process!
Output file : a.progrd.java6.jar => 5104 bytes ( C'n s: 5104 )
STEP 4 : PACK200 - REPACK
Input file : a.progrd.java6.jar
Command line>pack200 --repack a.progrd.java6.jar
Output file : a.progrd.java6.jar => 5116 bytes ( C'n s: not available )
STEP 5 : PACK200 - PACK
Input file : a.progrd.java6.jar
Command line>pack200 --effort=9 --strip-debug --no-keep-file-order -O --no-gzip a.progrd.java6.pack a.progrd.java6.jar
Output file : a.progrd.java6.pack => 7878 bytes ( C'n s: 7878 )
For this step, the command was supplied by Bonbon-Chan.
STEP 6 : PACK200 - UNPACK
Input file : a.progrd.java6.pack
Command line>unpack200 a.progrd.java6.pack a.progrd.java6Test1.jar
Output file : a.progrd.java6Test1.jar => 5096 bytes ( C'n s: not available )
Here, you are supposed to test the resulting jar in a standard applet code. You can do it locally.
STEP 7 : KZIP
Input file : a.progrd.java6.pack
Command line>kzip /s0 /rn /b128 /y a.progrd.java6.kz.pack a.progrd.java6.pack
Output file : a.progrd.java6.kz.pack => 4172 bytes ( C'n s: not available )
As recommanded by Groboclown, here the kzip command should be repeated until you see what is the minimum compression value with the option /b128. Then, values other than 128 should be tested ( like /b64, /b96, /b104, /b112... ), and for each /bX value, the kzip command should be repeated again, until you find the minimum value with the optimal /bX value.
STEP 8 : ZIP2GZIP
Input file : a.progrd.java6.kz.pack
Command line>java Zip2Gzip a.progrd.java6.kz.pack a.progrd.java6.kz.pack.gz
Output file : a.progrd.java6.kz.pack.gz => 4054 bytes ( C'n s: 4058 )
Here, you will have to compile yourself the Zip2Gzip program before using it. Its source code can be found here, as indicated by Groboclown :
http://www.java-gaming.org/topics/java-4k-resources-thread/21630/msg/177304/view.html#msg177304.
STEP 9 : DEPLOYMENT
Now you can deploy your a.progrd.java6.kz.pack.gz file on your server, with the following applet code ( provided by appel ) put into a .htm page :
1 2 3
| <applet code="a.class" archive="a.progrd.java6.kz.pack.gz" width="your width" height="your height"> <param name="java_arguments" value="-Djnlp.packEnabled=true" /> </applet> |
FINAL NOTES
- the obsfuscator programs jarg ( to use before Proguard ) and JoGa ( to use after Proguard ) didn't help with my code. Maybe I misused them, or my code did not fit well for them ;
- about using pack200, I missed a few steps as I didn't sign my jar. But you will find some detailed informations about it here :
http://docs.oracle.com/javase/1.5.0/docs/guide/deployment/deployment-guide/pack200.htmlhttp://docs.oracle.com/javase/6/docs/technotes/guides/jweb/tools/pack200.html- it seems you can't test your pack.gz program without a server ;
- special thanks to pjt33 and his Zip2Gzip automagical converter.