Java program only works on the development machine

1

I created a Java application in NetBeans. This application has a GUI and uses some external Jars.

After doing the Clean and Build in the dist folder of NetBeans appeared a Jar (main class) and a folder called lib (which has the external Jars that I use). When running Jar (main class) that is in the dist folder everything works normally. I checked the Class-Path and everything is OK. I've even changed the name of the folder where the libs are and the program has stopped giving, which means that the Jars in the lib folder are being used instead of others.

The problem is that when copying the dist folder (which has the main class and the external Jars) to another computer (with the same version of Java installed) the program does not work.

Can anyone help me?

    
asked by anonymous 10.11.2014 / 23:23

1 answer

5

When nothing happens when trying to open the program, it is because it has thrown an exception before even loading the graphic, so no error is shown to the user.

In order to see what the exception is being thrown you can run your jar through the command prompt or terminal, as it will throw the exception that is occurring and then you will get the explanation of your problem, so it will be easy to fix your project.

To invoke it from the command line use the following command:

java -jar nomedojar.jar

In your case, it is very likely that you are missing some dependency because the program works correctly on your computer and apparently the configuration of the other is okay, from what you said. With the exception hint at the prompt, add the missing jar to your project.

    
17.12.2014 / 15:19