سؤال

I am trying to extract a file from tar using the following command:

tar xzfv  mysql-connector-java-5.1.29.tar.gz mysql-connector-java-5.1.29-bin.jar

However tar command is unable to find mysql-connector-java-5.1.29-bin.jar even though it seems to be present. The folder structure which I get when extracting the tar file is:

The jar is present at http://cdn.mysql.com/Downloads/Connector-J/mysql-connector-java-5.1.29.tar.gz.

|-- mysql-connector-java-5.1.29
|   |-- CHANGES
|   |-- COPYING
|   |-- README
|   |-- README.txt
|   |-- build.xml
|   |-- docs
|   |   |-- README.txt
|   |   |-- connector-j.html
|   |   `-- connector-j.pdf
|   |-- mysql-connector-java-5.1.29-bin.jar
|   `-- src
|       |-- com
|       |   `-- mysql
|       |       `-- jdbc

I have not included the complete structure for brevity. But it can be seen that mysql-connector-java-5.1.29-bin.jar is present. I am unable to figure out the issue here.

هل كانت مفيدة؟

المحلول

First, try to list the files in the tar.

tar tvf mysql-connector-java-5.1.29.tar.gz

Then you can find that your file is located inside a directory in the tar

mysql-connector-java-5.1.29/mysql-connector-java-5.1.29-bin.jar

So to extract that file, you should use

tar zxvf mysql-connector-java-5.1.29.tar.gz mysql-connector-java-5.1.29/mysql-connector-java-5.1.29-bin.jar
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top