Forums Register Login

Converting Java to Exe error

+Pie Number of slices to send: Send
Ok so I compiled a java program and converted it to an exe file and it works fine on the computer I created the java file in but when i try it on another computer it gives me a "Java Virtual Machine Launcher - A Java Exception has occured" error message. Any ideas what could be causing this and how i could fix it? Thanks in advance.
+Pie Number of slices to send: Send
 

Hank Harrison wrote:Ok so I compiled a java program and converted it to an exe file and it works fine on the computer I created the java file in but when i try it on another computer it gives me a "Java Virtual Machine Launcher - A Java Exception has occured" error message.


Is that ALL it says; or is there more detail?

Any ideas what could be causing this and how i could fix it?


All sorts of things, but it sounds to me like something essential wasn't "packaged" with your exe.

Winston
+Pie Number of slices to send: Send
ok so when I upgraded the other computer to Java 8 that seemed to fix the problem. My next question is, is there a way to save the java file to make it compatible with previous versions of Java? or does the other user have to always upgrade to java 8 in order to use the program? Thanks.
+Pie Number of slices to send: Send
Normally, when you compile your code with JDK 8, then the user will need Java 8 or newer to run it.

There is a way to compile code with JDK 8 and make it run on older versions of Java: use the -source and -target command line options of the Java compiler. When you do that, however, you cannot use new language features that were added in Java 8. Also, you should not call methods or use classes or interfaces from the standard library that were new in Java 8. Note that the Java compiler will not protect you if you do: it will just compile the code, and when you then later try to run it on Java 7 or older, you might get an error because some method, interface or class does not exist. Therefore, if you want to be sure your code is runnable on an older version of Java, it is better to download and use the JDK for that version, and compile your code with that.
There is no greater crime than stealing somebody's best friend. I miss you tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 583 times.
Similar Threads
making a exe in java
Unhandled execption in EXE containing executable jar file.
Convert .jar to .exe file
how to make a java program instalable file??
Java to EXE
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 03:48:31.