Problem:-You encounter this error while executing your jar file then it is likely due to missing library files that your jar file needs to run.


For applications made using NetBeans Ide:-
  • Netbeans while making your jar file adds the classpath of the libraries needed for your application to the file and creates the folder lib in the dist folder containing the jar files that your application needs to execute.

  • If you copy and paste just the jar file and try to execute it it will raise an error, so instead of just copying the jar file copy the entire dist folder and then execute the jar. It will work.
For applications made without the Ide:-
  • To add the path of class libraries that are missing just create a plaint text file and then add the class path of the libraries to it. for example if you are getting error for the missing class file located under the xyz directory then you should add the variable as it is shown Class-Path: xyz/ and save the text file. Then you should execute the following command.

    jar cfm "Your jar File" "The text file you edited" "the files to add into the jar"

  • Now run the application using the command "java -jar application_name.jar" and it should work fine.
In case you still face problems regarding this issue post your problem and i'll solve it.