The executable jar does not work on other computers

I created a program using Eclipse and exported as an executable jar (I tried all 3 options for processing the library). It works fine on the computer on which it was written and exported, but when I try to run it on other machines, it does nothing. It does not cause errors, nothing. I have a few people to try this for me, no luck, and I tried to run it on my laptop (ensuring that Java is the latest version, the same as the machine on which it was written). The MANIFEST file correctly points to the main class.

Does anyone know how I can solve this problem?

This is incredibly frustrating! If you need more information, I can provide it.

+4
source share
4 answers

If the Java Runtime Environment (JRE) is not installed, the JAR will not open and will not show you any messages. Try installing the JRE on another computer and try again.

+1
source

This happened to me many times when I started writing distributed Java applications.

Check your project build path (since you are using eclipse, right-click on the project folder, then choose Build Path> Configure Build Path). If any of the above paths exists custom * ie C:\User\daMachineMaster\Java\jre\bin or something else, it will not work on any other computer, because the application will always look for this path that will not exist on a different machine than daMachineMaster . You can use the shell to fix this problem, as it encapsulates all the necessary information in .exe, for example.

If this is not a problem, search the code for any links to your local directories. For instance,

 String style = main.screens.ScreenFramework.class.getResource("C:\Users\Dwayne\Music\cool\DarkTheme.css"); 

Once you find these hard links, the solution changes them to relative links. Check How to determine relative path in java

In the above case, this would mean switching to something like:

 String style = main.screens.ScreenFramework.class.getResource("DarkTheme.css").toExternalForm(); 

Also, as mentioned in other answers, check if other hava Java nodes are installed. I don't think they need the environment variables defined to run the runnable jar, but if you want to run the application in cmdline with something like java -jar yourapp.jar , you need to go to Windows Explorer (assuming you use windows ), right-click "Computer", then "Advanced System Settings"> "Environment Variables"> "Create ..."> "Variable Name" = JAVA_HOME; Variable Value = directory where java is installed> OK> Press PATH> Change ...> add JAVA_HOME \ bin to PATH> OK

+1
source

First you need to install the Java Runtime Environment (JRE) , then you can directly run the .jar files on your computer. The Java Development Kit (JDK) download package contains the corresponding JRE, so you can also install too.

0
source

Sorry for the late reply. Thanks for all your answers, but it turned out that there was an error in my code that simply stopped working without showing any errors.

0
source

All Articles