#Launch4j .exe files don't work on other computers

1 messages · Page 1 of 1 (latest)

oak hull
#

So I have made a basic java code in IntelliJ Idea and then made it into a .exe file with Launch4j. I set the JRE Paths as %JAVA_HOME%;%PATH% and it worked fine on my pc. But it does not work on other people's computers. Some even have %JAVA_HOME% set correctly but the program just opens and instantly closes itself. Is there any way to specify a Java path better?

scarlet ivyBOT
#

<@&987246554085740594> please have a look, thanks.

#

Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#

rked fine on my computer. However, when I tried running the .exe file on another computer, it didn't work.

There could be a few reasons why the .exe file is not working on other computers:

  1. Java Runtime Environment (JRE) version mismatch: The other computer may not have the same version of JRE installed as your computer. Make sure that the JRE version used to compile your code and create the .exe file is compatible with the JRE version installed on the other computer.

  2. Missing or incorrect JRE paths: Check if the other computer has the correct JRE paths set up. The %JAVA_HOME% and %PATH% environment variables should point to the correct JRE installation directory.

  3. Missing dependencies: If your Java code relies on external libraries or resources, make sure that those dependencies are included with your .exe file or are available on the other computer.

  4. Security settings: The other computer may have stricter security settings that prevent running executable files from unknown sources. Try running the .exe file with administrator privileges or adjust the security settings accordingly.

#

To troubleshoot and fix these issues, you can try the following steps:

  1. Verify JRE versions: Check which version of JRE is installed on both computers and ensure they are compatible.

  2. Bundle required dependencies: If your code relies on external libraries or resources, consider bundling them with your .exe file using tools like Maven Shade Plugin or Gradle Shadow Plugin.

  3. Test on different computers: Try running your .exe file on multiple computers to identify if it's a specific issue with one particular machine or a more general problem.

  4. Provide clear instructions: If you distribute your .exe file to others, make sure to provide clear instructions for setting up JRE paths and any necessary dependencies.

  5. Consider alternative packaging options: Instead of using Launch4j, you can explore alternative packaging options like JAR files or native installers (e.g., Inno Setup, NSIS) that can simplify the deployment process and ensure compatibility across different computers.

Remember to thoroughly test your .exe file on various computers to ensure it works as expected before distributing it to others.

oak hull
#

it might be a version mismatch. if it is, then how the other people going to use it? I think the only way is to bundle a JRE in my exe

timber flicker
#

You have to provide the JRE as part of the distribution.

grizzled cairn
#

if you can, use jpackage to package your application

scarlet ivyBOT
#

@oak hull

Your question has been closed due to inactivity.

If it was not resolved yet, feel free to just post a message below
to reopen it, or create a new thread.

Note that usually the reason for nobody calling back is that your
question may have been not well asked and hence no one felt confident
enough answering.

When you reopen the thread, try to use your time to improve the quality
of the question by elaborating, providing details, context, all relevant code
snippets, any errors you are getting, concrete examples and perhaps also some
screenshots. Share your attempt, explain the expected results and compare
them to the current results.

Also try to make the information easily accessible by sharing code
or assignment descriptions directly on Discord, not behind a link or
PDF-file; provide some guidance for long code snippets and ensure
the code is well formatted and has syntax highlighting. Kindly read through
https://stackoverflow.com/help/how-to-ask for more.

With enough info, someone knows the answer for sure 👍

timber flicker
#

If you are still trying to get this working take a look at the blog I wrote when I did this. It should explain what you need to do to deploy to other users. Just respond to this if you have questions. https://softwarepulse.co.uk/blog/how-to-build-an-executable-file-for-a-java-11-gui-application-using-launch4j/

The aim is to package up our Java application so that we can distribute it to others. We want them to be able to launch the application without having to install anything else.