I have my program deduction.java . I compiled it successfully. I used mysql-connector-java-5.0.8-bin.jar file at compile time. Now I want to make single jar file which should have deduction.java and mysql-connector-java-5.0.8-bin.jar classes.
I used this command
jar -cvfe deduction.jar *.class
but I am not able to include mysql-connector classes. Please help to solve this.
Actually, you should not try to regroup your dependencies into a single .jar, but instead provide them separately. I guess your application is a command-line executable? You have many options:
your-app/
/app.sh
/deduction.jar
/mysql-connector-java-5.0.8-bin.jar
And your app.sh would look like
java -cp deduction.jar;mysql-connector-java-5.0.8-bin.jar deduction
Assuming the class deduction contains your main() method
Create a folder, unpack mysql-connector-java-5.0.8-bin.jar in it, add deduction.java and run
jar cvf deduction.jar *
inside this folder. Or copy mysql-connector-java-5.0.8-bin.jar as deduction.jar then add deduction.java to it
jar uvf deduction.jar deduction.java
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.