Packaging a Java Application

I’m sure this has been discussed and asked and answered and so on, but I still am not sure. What’s the best way to distribute a java game to best resemble a standalone application?

  1. Distribute as a normal jar file. Obviously, this makes your code easy to read, hack, steal, etc.
  2. Obfuscation. This seems to be a popular choice, but it also seems to be able to be thwarted.
  3. I’ve heard of compiling java to native code, but I’m not really sure how that works.

What are the pros and cons to each of these methods, and are there any others that I’m missing? Thanks in advance.

Use jsmooth or similar. Don’t obfuscate. Include as much debugging as possible. Don’t rely on system JVM - always always always package your own private JVM. Provide 3 separate downloads for Windows, Mac, and Linux.

Cas :slight_smile:

No one cares about your code.
Don’t ‘worry’ x)

@#3: Sometimes Excelsior JET can compile it to native code. It’s nice and work. But overall really not needed on desktop, if you just package your own jdk or openjdk…

For Windows, I personally make a batch to run my stuff, compile that to an exe with a converter, and yeah a jdk is packaged.
Very easy. But those tools to package are also nice when they work. I just get confused when it comes to my assets when using those… x)

Ah, packaging a copy of the JRE. That’s brilliant. So my application would be compatible on the target machine for as long as that machine supports that specific version of the JRE.

Thanks a lot for the info, guys! :slight_smile:

What’s the rationale behind not obfuscating? Primarily speed?

I’ve not used one so I am not really familiar with the negatives.

@ziozio Anybody who was interested in looking at your code could de-obfuscate it relatively easily (i.e. Minecraft)

There’s no speed difference but it will save you about 1000 headaches debugging logs from users when your game doesn’t work on their systems or just crashes mid-game etc. etc.

CAs :slight_smile:

Minecraft - never have open source code (as i know)
it was obfuscated )
but this not helped much, as all we know XD

(readable source code of minecraft that you can find - is giant work of enthusiasts that manually rename all obfuscation to normal code)