0

On OS X, when I try to run a .jar file, the system would ask me to download Java Runtime Engine if I don't have it installed, which makes sense.

However, on Microsoft Windows, that doesn't happen; I simply get a typical window message saying I don't have any program to open that kind of file.

Is there anyway to let the user know he needs to have the JRE, because otherwise the typical end-user won't understand how to handle it.

  • The proper way to handle this behavior is to create an installer which downloads and installs Java for the user then installs your application. – Ramhound Apr 8 '15 at 14:13
  • I don't really want the user to install my app, since it's only a jarfile. And it must be very thin (less than 1mb) which does not allow me to have a full package along. – hugohilario Apr 8 '15 at 14:16
  • 1
    Without an installer what you won't won't be possible. OS X handles .jar files differently then Windows out of the box. Windows has no idea how to handle .jar files unless Java is installed. The installer will solve that problem for you. – Ramhound Apr 8 '15 at 14:18
1

You don't want the user to "install" your app, and you don't want to distribute a large package, but, if you're willing to add a second file, you can obtain the result you want by distributing a .bat file with your .jar.  A batch file can implement the behavior you describe:

  • Check whether JRE is installed.
    • If if is, run the JAR.
    • If it isn't, display an informative message.
  • That does not fit my need since I can only send one file (jar). If I was able to use .bat files I was also able to use an .exe and put all behaviour there. But unfortunately exe/bat are considered dangerous and therefore email services like gmail will block them. Thanks – hugohilario Apr 13 '15 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.