0

I've made a game, have already exported it from eclipse to a .jar file, but none of my friends could open the file. "java virtual machine launcher: a java exeption has occured" appeared to all of them.

So i tried to find a way to turn this .jar file in an .exe file, and it kinda worked. Using launch4j aplication, i was able to create an .exe, but it still didn´t work for everyone (except me). for some reason, it doesn´t matter what i try, the only one who can open the file is me.

i have already:

  • turned it into .exe (worked for me, failed for everyone)
  • tried to bundle a jre by indicating path (failed)
  • bundled a jre by tipping %JAVA_HOME% at bundled jre section (worked for me, java version error for everyone)
  • let min and max java version requiriments empty (worked for me, java version error for everyone)

and now I don't know what to do, i searched so deep in the internet, but all possible answers appears to do nothing. I don´t now if i made a mistake in launch4j or if I have a problem in my java instalation itself, but i simply can't publish my project whitout solving this problem. Do anyone have any sugestions?

  • 1
    Don't guess, but instead find and solve the problem: have them run the jar on the command line to see the full exception's stack trace. – DontKnowMuchBut Getting Better Feb 15 '22 at 00:30
  • And no, creating an .exe is most definitely ***not*** the solution. First find the source of the problem. – DontKnowMuchBut Getting Better Feb 15 '22 at 00:31
  • 2
    *"Do anyone have any suggestions?"* - Basically, you need to debug it. Get access to a machine where the problem occurs, and figure out what is actually going on. Searching for and trying "solutions" from the internet won't work unless the problem they solve is your problem. And at this point, you don't know what your problem is. (Beyond the generic "it doesn't work".) – Stephen C Feb 15 '22 at 00:53
  • 1
    Of course, the other approach would be to provide your friends with instructions on how to download and install Java by hand, etcetera. (The problem could conceivably be an application-level bug that also happens with a hand-installed JDK ... on other peoples' machines. For example, your application's JAR may be trying to access files that only exist on your machine.) – Stephen C Feb 15 '22 at 00:56
  • @StephenC These days it is recommended to ship your application with a JRE (e.g. a JRE from https://adoptium.net/ which allows to do so). When using Java 9 or higher, you can use `jlink` to minimize the size. See also [`jpackage`](https://openjdk.java.net/jeps/343). – howlger Feb 15 '22 at 09:11
  • 1
    That is definitely true. However, I have a suspicion that the reason for the failure of the OPs attempts at using launch4j may *actually* be a a problem with the application. Getting someone to install a full JDK and run a bare JAR will help to eliminate that as the cause. – Stephen C Feb 15 '22 at 09:57

0 Answers0