JavaGaming.org

July 30, 2010, 09:30:48 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
Advanced search  
Pages: 1 [2] 3 4 ... 6   Go Down
Print
Author Topic: Java 4k Resources Thread  (Read 13061 times)
0 Members and 1 Guest are viewing this topic.
Bonbon-Chan
Sr. Member
****
Offline Offline

Posts: 273



View Profile
« Reply #30 on: December 02, 2009, 12:51:44 am »

I don't really get the pack200 stuff...
I have try to make a batch file to optimized my jar size (it executes itself automatically with netbean after a clean&build) :

Code:
"C:\Program Files\Java\jdk1.6.0_13\bin\jar" uf dist\k2010.jar META-INF\MANIFEST.MF

java -jar C:\proguard\lib\proguard.jar @k2010.pro

"C:\Program Files\Java\jdk1.6.0_13\bin\pack200" --effort=9 -O --no-gzip dist\k2010.jar.pack dist\k2010_.jar
"C:\Program Files\7-Zip\7z" a -tgzip -mx=9 dist\k2010.jar.gz dist\k2010.jar

echo off
echo ---------------------------------------------------------------------------
echo ---------------------------------------------------------------------------
dir dist\*.*
echo ---------------------------------------------------------------------------
echo ---------------------------------------------------------------------------

I get :
Code:
6 834 k2010.jar               // netbean jar
2 851 k2010.jar.gz          // gzip pack
4 693 k2010.jar.pack      // pack
4 078 k2010_.jar            // proguard jar

So, i think it works but are my option right ? Is it the .jar.gz that should be under the 4096 ?
Logged
Abuse
JGO Kernel
*********
Offline Offline

Posts: 1783

falling into the abyss of reality


View Profile
« Reply #31 on: December 02, 2009, 04:06:38 am »

Compile 'n Shrink - HTTP Service

http://www.indiespot.net/app/java-four-kay

Funky,

Could you also provide a means of attaching resource file(s) to be included in the resultant pack.  Kiss
« Last Edit: December 02, 2009, 04:43:52 am by Abuse » Logged
Markus_Persson
Global Moderator
JGO Kernel
*****
Offline Offline

Gender: Male
Posts: 2083


Mojang Specifications


View Profile WWW
« Reply #32 on: December 02, 2009, 04:23:28 am »

So, i think it works but are my option right ? Is it the .jar.gz that should be under the 4096 ?

Yes. But the name should really be k2010.pack.gz
Logged

Play Minecraft!
soothsayer
JGO n00b
*
Offline Offline

Posts: 19


View Profile WWW
« Reply #33 on: December 02, 2009, 04:28:01 am »

Compile 'n Shrink - HTTP Service

http://www.indiespot.net/app/java-four-kay

Fantastic!!! Cool Who maintains this site? Is it a permanent project?
Logged
Riven
Moderator
JGO Kernel
*****
Offline Offline

Gender: Male
Posts: 1583


She is my Lorentz Attractor


View Profile WWW
« Reply #34 on: December 02, 2009, 06:33:30 am »

Fantastic!!! Cool Who maintains this site? Is it a permanent project?

Thanks. Me. Yes.


I bet I can improve it further, as I'm currently not even using an obfuscator to shrink the method/field names.
Logged

soothsayer
JGO n00b
*
Offline Offline

Posts: 19


View Profile WWW
« Reply #35 on: December 02, 2009, 06:48:49 am »

Thanks. Me. Yes.


I bet I can improve it further, as I'm currently not even using an obfuscator to shrink the method/field names.

Thank you.

By the help of this tool I can finally create my jar file easily. I had a big problem with compression until now.
Logged
Markus_Persson
Global Moderator
JGO Kernel
*****
Offline Offline

Gender: Male
Posts: 2083


Mojang Specifications


View Profile WWW
« Reply #36 on: December 02, 2009, 06:56:46 am »

Do you store all java classes submitted there, or can we use it without giving all your source code to you? Wink
Logged

Play Minecraft!
Riven
Moderator
JGO Kernel
*****
Offline Offline

Gender: Male
Posts: 1583


She is my Lorentz Attractor


View Profile WWW
« Reply #37 on: December 02, 2009, 07:11:02 am »

Do you store all java classes submitted there, or can we use it without giving all your source code to you? Wink

Yeah, it was very tempting, but I resisted. The only file that is stored, is the generated .pack.gz file, so you can download it. I can probably launch a thread to remove it after a minute or so.
Logged

Riven
Moderator
JGO Kernel
*****
Offline Offline

Gender: Male
Posts: 1583


She is my Lorentz Attractor


View Profile WWW
« Reply #38 on: December 02, 2009, 07:13:48 am »

I just updated the service, so that it actually gives you plain-text error messages, it something would go wrong before the external processes are launched.


I submitted my Poker4K app (2006) which was exactly 4096 bytes, and it came out at 3592 bytes.
« Last Edit: December 02, 2009, 07:15:47 am by Riven » Logged

Markus_Persson
Global Moderator
JGO Kernel
*****
Offline Offline

Gender: Male
Posts: 2083


Mojang Specifications


View Profile WWW
« Reply #39 on: December 02, 2009, 07:24:43 am »

Left 4k Dead went from 4096 bytes to 4019.

Neat. Cheesy
Logged

Play Minecraft!
Riven
Moderator
JGO Kernel
*****
Offline Offline

Gender: Male
Posts: 1583


She is my Lorentz Attractor


View Profile WWW
« Reply #40 on: December 02, 2009, 07:35:45 am »

Can anybody give me a kickstart on which proguard parameters to use?

Even if I use the most basic / safe parameters, the jar file comes out at under 300 bytes, and obviously it doesn't even remotely work.
Logged

Markus_Persson
Global Moderator
JGO Kernel
*****
Offline Offline

Gender: Male
Posts: 2083


Mojang Specifications


View Profile WWW
« Reply #41 on: December 02, 2009, 07:38:17 am »

It's probably removing the entire class since it's "not used". Try this:

Code:
-keep public class * extends java.applet.Applet
-keep public class * extends javax.swing.JApplet

Or: http://proguard.sourceforge.net/manual/examples.html#applet
« Last Edit: December 02, 2009, 07:40:50 am by Markus_Persson » Logged

Play Minecraft!
Riven
Moderator
JGO Kernel
*****
Offline Offline

Gender: Male
Posts: 1583


She is my Lorentz Attractor


View Profile WWW
« Reply #42 on: December 02, 2009, 07:43:47 am »

I did:

Code:
-keep class *

which apparently didn't patternmatch 'public class X'.


* Riven is updating the webservice
Logged

Riven
Moderator
JGO Kernel
*****
Offline Offline

Gender: Male
Posts: 1583


She is my Lorentz Attractor


View Profile WWW
« Reply #43 on: December 02, 2009, 07:49:33 am »

Thanks Markus!

I submitted my Poker4K app (2006) which was exactly 4096 bytes, and it came out at 3592 bytes.

3508 bytes bytes now.
Logged

Markus_Persson
Global Moderator
JGO Kernel
*****
Offline Offline

Gender: Male
Posts: 2083


Mojang Specifications


View Profile WWW
« Reply #44 on: December 02, 2009, 08:06:11 am »

Left 4k Dead got BIGGER!
G.pack.gz   => 4259 bytes
Logged

Play Minecraft!
Riven
Moderator
JGO Kernel
*****
Offline Offline

Gender: Male
Posts: 1583


She is my Lorentz Attractor


View Profile WWW
« Reply #45 on: December 02, 2009, 08:10:31 am »

Hrr... I'll make 2 outputs... one with, and one without proguard
Logged

pjt33
JGO Ninja
*****
Offline Offline

Posts: 599


View Profile
« Reply #46 on: December 02, 2009, 08:17:16 am »

I did:

Code:
-keep class *

which apparently didn't patternmatch 'public class X'.
Try
Code:
-keep public class *
or
Code:
-keep * class *
I used
Code:
-keep public class a
but that has an obvious downside...
Logged
Riven
Moderator
JGO Kernel
*****
Offline Offline

Gender: Male
Posts: 1583


She is my Lorentz Attractor


View Profile WWW
« Reply #47 on: December 02, 2009, 08:23:54 am »

Now outputs 2 files. I'll probably only output the smallest file later on.
Logged

appel
Moderator
JGO Neuromancer
*****
Online Online

Gender: Male
Posts: 1116


I always win!


View Profile WWW
« Reply #48 on: December 02, 2009, 08:55:16 am »

Left 4k Dead got BIGGER!
G.pack.gz   => 4259 bytes

You just code better than pack200 can compress ,)
Logged

Check out the 4K competition @ www.java4k.com
Check out GAMADU (my own site) @ http://gamadu.com/
moogie
JGO Ninja
*****
Offline Offline

Posts: 734


Java games rock!


View Profile
« Reply #49 on: December 02, 2009, 01:11:39 pm »

I'm curious; does pack200 invalidate the 'inject binary data into class files' space saving paradigm?

looking at the pack 200 spec, (section 5.9) it looks like you can manually inject an encoded attribute into a pack encoded class by defining an appropriate "attribute band"

However i do not think that it will compress any smaller than the pack 200 native non-class file storage as it seems be quite tight: as a minimum per file it will have a name (reference into the pack 200 constant pool) file size (32 or 64 bits depending file size) and then the raw file data.
Logged
Demonpants
Global Moderator
JGO Kernel
*****
Offline Offline

Gender: Male
Posts: 2539


Live Engineer at ngmoco:)


View Profile WWW
« Reply #50 on: December 02, 2009, 03:55:27 pm »

Hrr... I'll make 2 outputs... one with, and one without proguard
Instead of that, maybe provide checkboxes for each tool you link to and have them all checked by default. Depending upon how fast your utility is, you could even have your service construct results for every possibility, then just return the smallest one.
Logged

See my work:
OTC Software


Current Project(s):
Agent: 00PK
Voodoo Vendetta
steveyO
Full Member
***
Offline Offline

Gender: Male
Posts: 223



View Profile WWW
« Reply #51 on: December 08, 2009, 07:25:55 am »

Does anyone know where I can get Moogies program?  Last years link doesnt seem to work (http://unlimited.woogley.net/hosted/moogie/4KJOv3.zip).  I remember using it to good effect last year.
Logged

www.bullsquared.com   Play games, make friends, talk Bull!
moogie
JGO Ninja
*****
Offline Offline

Posts: 734


Java games rock!


View Profile
« Reply #52 on: December 08, 2009, 01:11:59 pm »

Does anyone know where I can get Moogies program?  Last years link doesnt seem to work (http://unlimited.woogley.net/hosted/moogie/4KJOv3.zip).  I remember using it to good effect last year.

hmm... your right, woogley's hosting seems to have stopped.

I am in the process of making v4 to output pack200 compressed output but if you want to use it right now i have attached it to this post.

It is in two parts, you will have to rename it from .pdf to .zip as this board does not accept zip files and max file size of 1.5meg.
Logged
moogie
JGO Ninja
*****
Offline Offline

Posts: 734


Java games rock!


View Profile
« Reply #53 on: December 08, 2009, 01:15:07 pm »

Part 2 of the 4kjo tool.

Just a reminder that the tool is not very robust (as it was an in house tool) so it expects to be run from the command line with the working path to be where the tool is located.

Also i recall that some of the optimizers used do not handle file paths with spaces so best to not have paths with spaces Smiley

Logged
steveyO
Full Member
***
Offline Offline

Gender: Male
Posts: 223



View Profile WWW
« Reply #54 on: December 08, 2009, 02:23:43 pm »

Thanks moogie, You star!!  Its pretty damn good..   4.6K -> 2.9K using your tool...  To 2.1K after using Pack200..

If you can combine the 2 in version4 would be perfect!   If you need somewhere to host it PM me and I'll put in on my website..
Logged

www.bullsquared.com   Play games, make friends, talk Bull!
moogie
JGO Ninja
*****
Offline Offline

Posts: 734


Java games rock!


View Profile
« Reply #55 on: December 08, 2009, 05:47:45 pm »

Glad it helps.

Version 4 should be able to get it smaller tham 2.1k as i will use use the kzip or BJWdeflate to compress the .pack file to produce the .pack.gz.
Logged
Demonpants
Global Moderator
JGO Kernel
*****
Offline Offline

Gender: Male
Posts: 2539


Live Engineer at ngmoco:)


View Profile WWW
« Reply #56 on: December 09, 2009, 07:48:33 am »

hmm... your right, woogley's hosting seems to have stopped.

I am in the process of making v4 to output pack200 compressed output but if you want to use it right now i have attached it to this post.

It is in two parts, you will have to rename it from .pdf to .zip as this board does not accept zip files and max file size of 1.5meg.
I can host the file on my site if you like. Just give me permission and I'll put the ZIP on it.

EDIT: I'll just assume you don't mind, because I won't have time to put this up again later. Wink

http://www.otcsw.com/files/4KJOv3.zip
« Last Edit: December 09, 2009, 07:54:48 am by Demonpants » Logged

See my work:
OTC Software


Current Project(s):
Agent: 00PK
Voodoo Vendetta
moogie
JGO Ninja
*****
Offline Offline

Posts: 734


Java games rock!


View Profile
« Reply #57 on: December 09, 2009, 01:01:42 pm »

I can host the file on my site if you like. Just give me permission and I'll put the ZIP on it.

EDIT: I'll just assume you don't mind, because I won't have time to put this up again later. Wink

http://www.otcsw.com/files/4KJOv3.zip

hehe no problems Smiley

I will *try* to get the updated version done when i get some "free" time... such time seems very rare lately Sad
Logged
SquashMonster
JGO n00b
*
Offline Offline

Posts: 48


View Profile
« Reply #58 on: December 10, 2009, 07:13:50 pm »

Riven, your (absolutely brilliant) tool seems to be giving me a 404 when I try to access it.  Were we taking up too much of your server's CPU?
Logged
Riven
Moderator
JGO Kernel
*****
Offline Offline

Gender: Male
Posts: 1583


She is my Lorentz Attractor


View Profile WWW
« Reply #59 on: December 11, 2009, 05:25:25 am »

Oh, no, not a problem. Just upgraded to another server, and have to restore that 4K app and my JGO avatar, which had low-priority for now.
Logged

Pages: 1 [2] 3 4 ... 6   Go Up
Print
 
Jump to: