A jar file cannot have its dependency jars inside. In case of Eclipse, it will unpack all the classes from the dependency jars and will bundle it into your single jar along with your class files. If not in the eclipse way, you need to
1) Create a manifest file which lists all the dependency jars
Manifest-Version: 1.0
Main-Class: Your Main class
Class-Path: dependency1.jar dependency2.jar dependency3.jar
dependency4.jar dependency5.jar
2) Create your jar with your class files using the class path including all the dependency jars and using the above created mainfest file.
3) In this same folder where you created your jar, place all the dependency jars.
Now your folder will look like this,
yourjar.jar (With the manifest file you created above)
dependency1.jar
dependency2.jar
dependency3.jar
dependency4.jar
dependency5.jar
4) Now if you want to share this, you need to share this folder and you can launch your jar from this folder. This is your executable folder and you can run it from anywhere.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…