How can I run a jar that needs several jars to work?
Let me explain, I have for example a project with a jar “Main.jar” but to run this Main.jar I need jdom.jar(for xml file), jGit.jar…
Assume we need more than two jars. How can I run my Main.jar?
By including the needed jar files in the classpath. Something like:
If you are under Windows and would like to execute the
Main.jarwith a double click, you will need to create a.batfile and use that one instead to run your program. The content of the.batfile will have the above command.Under Unix/Linux you will create a shell file with the similar content.
Note that the
-cpargument values will need to contain all the jars that your Main.jar is depended on.