What is wrong with Jars?

I always wonder why people are always making Mac versions, Windows versions and Linux versions… I just make a single jar for them all… Is there anything wrong with that? I find it easier for both me and the end user…

Reasons for per-OS versions:

  • OS-specific bugs
  • Only packing needed natives
  • So people can have nicer ways to open a jar file (e.g. Executables (.exe))

CopyableCougar4

I think jars are a fine way to deploy for most purposes.

However, they do require that your user has Java installed, and on their path. If they don’t, your typical user will not bother going through the rigmarole just to play your game or run your application.

Packaging as a platform-specific executable allows you to package the JRE with your application, so your user doesn’t have to worry about that.

But again, for most purposes, that’s overkill, and a jar is probably a fine option.

No, there’s nothing really wrong with that, but I don’t know anybody outside of dev that knows what a .jar file is…people are more comfortable with what they know (and obviously the downsides already noted).

  • OS specific bugs
    What does this mean?

  • packaging only needed files
    My jars are still very small with compression and still launches quite fast

  • so people can have a nicer way to open a jar file
    Nicer? It is still opening it in the same way… And most people have the file extensions turned off…

  • needs Java and path set up
    Most people have Java already and why do you need the path set up?

  • people don’t know what a jar file is
    They don’t need to know… All you need to say is they need Java (plus a link to the download)…

IMO having a version for Mac, Windows and Linux is just wasting one of the best features of Java, which is having one program that can run anywhere…

[quote]IMO having a version for Mac, Windows and Linux is just wasting one of the best features of Java, which is having one program that can run anywhere…
[/quote]
With JNI this is more make once, tweak and run anywhere

[quote]OS specific bugs
[/quote]
For example, let’s say that on Macs the mouse coordinate is always 5px to the right. Now this is NOT an example where you would repackage it, but it would certainly require some tweaks. I’m sure that there are more extreme examples out there.

CopyableCougar4

[quote]- people don’t know what a jar file is
They don’t need to know… All you need to say is they need Java (plus a link to the download)…
[/quote]
Most people won’t bother downloading programs to play your game unless it’s popular. Take Minecraft for example, I can guarantee you a lot of people had no idea what Java even was before Minecraft came out. A lot of them probably didn’t have it installed, either, but as soon as the Minecraft craze came about, it was suddenly worth it to install the JRE. No offense, but unless your game is popular or very interesting no one will go the extra mile to install the programs needed just to make your game work. People are inherently lazy and will put out the minimum amount of effort required to get the most enjoyment out of their life. If your game won’t run, then it’s not a loss to them because there are plenty of other games that are just as entertaining and fun, or even more so, then your’s.

There are many reasons to go native at least for the launcher, not really a dedicated article but look at some of the features of Launch4j: http://launch4j.sourceforge.net/

You’re not packaging dozens of megabytes per OS.

Nicer as in it won’t fail if they don’t have Java, or as in it has a nice icon/thumbnail of your game. Not everyone sees the .jar icon and knows that it’s an executable that you should double click. Plus it’s just nice and professional.
Luckily Minecraft has raised quite a bit of “awareness” about some of this, and increses number of Java installations, but a lot of those little kids wouldn’t know. Even they do a native launcher, because it’s stupid not to.

Luckily making the launcher and any installers native is all you really need, esp. if you also embed a JVM in case the user doesn’t have one installed. (good idea for anything professional)
Your program is still in Java and runs on the JVM, but the user never has to know (or have the respective issues).



Just wondering (bit off topic) is it possible to check if someone has Java installed through HTML?

No, HTML is purely a markup language, which means it’s just a set of commands that instructs the DOM how to organize the content of a webpage. JavaScript is the actual “programming” of a webpage (or at least one of the many languages; JS is just very popular). I doubt you can actually do what you are asking about, but I just wanted to clear that up.

Edit:

These people seem to do it: http://service.parachat.com/knowledgebase/194/How-can-I-test-whether-Java-is-working-on-my-computer.html

EDIT: dammit, nvm.

But really it’s probably much easier to have your installer (which is native) detect and download if required.

Sry, I just say HTML when I mean the complete ‘set’:
HTML, JavaScript, CSS, PHP (or other server side scripting), SQL (or other database system)

I looked at those… I’m thinking of using the detectJava.js thingy… But I couldn’t find a link to it on oracle.com or Java.com… I hate when they have things which you have to go though a maze of a website to try to find it…

With the exe launcher (or app or something else), im guessing you either need the JRE with it or ask for the JRE to be installed…

The first way makes the download really large and the second one is no different to using detectJava.js on the website…

So again, why not just jars?

I just prefer jars but then again, people have their own choices…

YOU may prefer jars, but that’s because you are a Java developer. The vast majority of people don’t know what a Jar is or what it’s used for. People aren’t going to go the extra mile to install the JRE if they don’t have to, like I said before. People are telling you why not Jars, I don’t know what other information you want.

There are launchers which in the absence of a JRE can download one silently, it just looks like the installation takes longer.
But packaging one yourself is pretty much the best option. Using minification techniques the JRE can be squished surprisingly small. (esp. with project jigsaw on the way)

Also static compilation and transpilation are interesting. http://www.ikvm.net/

Consumers have no damn idea what a Jar is, it’s as simple as that.

You also have people who are in Rayvolution’s situation where you need the individual OS executables for the game to run properly on whatever platform its published to (in his case, Steam). I imagine that other sites like GameJolt and itch.io also face similar issues with their downloads.

  • Jev

But I just don’t see the point in it…
Why use Java when you scrap one of Java’s best features?
You might as well use something like Google’s GO (although I won’t)

I think you’re misinterpreting one of Java’s “best features” are. You aren’t scrapping anything.

The idea is that you write once, run everywhere.

You’re still only writing the code once for all platforms. However that is exported and packaged is irrelevant.

  • Jev

Think of it on a much bigger scale, like Steam, GoG, Desura, or the general public.

Steam for example won’t launch .jars directly, and it needs to know what executables to use to launch it for each platform. Jars are also unwieldy for non-techies, a lot of people don’t even know what they are. It’s extremely easy to just make executables for all 3 platforms that just runs a simple command line, that’s basically all mine do. I never have to update/change them, I just drop in updated jars/resources into the game folder and my game will launch the latest version with the old executables. So really I’m not even packaging anything, I still use the jar.

While .jars are perfectly fine for us Java people, others are scared of them. Also huge portion (My guess is over 50%) of the internet has Java installed incorrectly and can’t double click to launch jar files, and they’re not tech savvy enough to know how to fix it. Thus, making a platform executables solves that problem, even allowing you to go as far as I did with Retro-Pixel Castles and including bundled JREs so it doesn’t even matter if their copy of java is installed at all, it just works. :slight_smile:

Ok, but is there some sort of program where I can put in a Jar, some natives, and some library jars and it will create a launcher for Mac, Linux and windows?

JarSplice.

  • Jev