Recompiling Java

I’d like to recompile one of my java games to run on Windows without the need for any kind of JVM installed. it makes use of swing and BufferStrategy. is this possible? and if so, can someone tell me where i can find a good recompiler?

if it is possible what size would you expect the .exe to be once it’s compiled?

The final exe will have almost the size of your programm + JRE :>

Well the JRE is only bout 10 mb… and everyone should update it from time to time… even if they need it only for applets.

If my arguments can’t stop you search for “Jet”.

what’s princec’s Alien flux game compiled with? or is that just some kind of wrapper that detects and uses the existing JRE?

Cas has used Jet and it compiles to native. His game is quite small because he hasn’t used Swing, Awt or anything else “bloaty”.

You only have to whisper “AWT” at Jet and your exe grows by 4 megs or something. And of course it costs 500 quid for the compiler. Worth it though IMO.

Until we get the JVM we’ve been asking for :wink:

Cas :slight_smile:

yeah i have dowloaded the JET personal edition. might not work… anyway if it makes the game that big then i dont think i’ll bother with it. just release the jar file.

I also tried a while ago a packager from “duckware” called jexepack that would direct the user to the java download page if they didnt have the JVM installed (it just found and used the installed jvm like a jar file…) that was trial ware and he wanded $30 US (60 aus) for it… actually, i think i’ll stick with BAT files for now…

hmm 20 minutes remaining… what’s this thing doing? recompiling the entire JDK?

Well, i compiled this jar file… i think it must be just the fact that im using the personal version… only came out at 252 kb (the jar is 177 kb)

but as i suspected this cant be run on any computer other than the one i compiled it on… (with or without the jvm installed)

anyway, if you have some time, princec, do you think you could compile this jar for me?

http://members.austarmetro.com.au/~juddman/files2/JMTetris10.jar

ok, comes out at 6.9 mb. much better to have people download JRE once then only a couple of hundred kb to download newer versions… if i make any.

how would a ‘windowed’ app be made that doesnt use AWT?

Use SWT.

Won’t have time to do any compilation for a while.

Cas :slight_smile:

What about gcc? Can’t gcc compile java to native?

SWT? hmm i’ll google… found… (standard widget t-something) is that it? looks interesting, might take a more in depth look sometime.

im not planning to make this tiny game into .exe now. mainly i was trying to do it out of interest.

well, i might as well put my jar up on the web site for download now

might also look into java web start. that’d be a useful tool for something simple like this.

anyone got some pointers to tutorial or info on how to start with this? might look around the java web site.

gcj is a branch of gcc and can actually compile java source or byte-code to native and is free.
only problem is that it doesnt support AWT+Swing yet but once it does…

SWT (standard widget toolkit) is a api which is a bit like awt and allows you to do windowed stuff. its a bit closer to the system then awt. its made by the eclipse people (www.eclipse.org).

you can compile the swt-jars with gcj and and use it to make fully native windowed apps. (there should be a tutorial for this somwhere on the gcj site)