Extracting tar.bz2 files.
How can i extract tar.bz2 files?. zip, jar, tar can be extracted within java. But how tar.bz2?.
Some tars have built-in knowledge of the bz2 (bunzip) compression format.
Tar ("tape archive") is to package several files in one archive or to extract them. The archive files can be called "*.tar".
Similar Messages
-
Downloading .tar.bz2 files ...
... why in **** does Safari add another .tar to .tar.bz2 files, and how do I stop it? Many thanks for the person who knows this one.
-peterHi,
It's probably due to the mime encoding specified on the server side - Safari tends to believe what it's told.
Assuming you're getting the file from wireshark.org, that download is reported as 'Content-Type: application/x-tar'
(Compare that to the gzipped tar file there which is correctly defined as 'application/x-gzip') -
when try to:
$gzip -dc /dbdump/patch/oraInventory_BK.tar.gz | tar xf /tmp/t
tar: 0511-164 There is a media read or write block size error.
how to unzip/ extract tar sucussfully?
AIX box
thanksPreferably Unix questions are answered by consulting man pages or an Unix forum.
Your questions is 100 percent of topic here. Kindly stop posting Unix questions here.
Sybrand Bakker
Senior Oracle DBA -
Hi,
I have a file with extension tar.gz and i need to extract it. I tried with GZIPInputStream class of java.util.zip package but could not do it. Below is the code snippet for the same. Please suggest the way we can handle this problem in Java.
String filename = "C:\\TarFile\\Test.20110519_123033_00001.tar.gz";
final int BUFFER_SIZE = 2048;
try {
BufferedOutputStream dest = null;
FileInputStream fis = new FileInputStream(filename);
GZIPInputStream zis = new GZIPInputStream(new BufferedInputStream(fis));
int len;
FileOutputStream fos = new FileOutputStream("C:\\TarFile\\Test.20110519_123033_00001.tar");
dest = new BufferedOutputStream(fos, BUFFER_SIZE);
byte data[] = new byte[BUFFER_SIZE];
while ((len = zis.read()) != -1) {
//int count;
// write the files to the disk
dest.write(data, 0, len );
//dest.flush();
dest.close();
zis.close();
}catch(Exception e) {
Thanks.By words "could not do it" , it should be very much clear that - i could not extract the file tar.gz completely. That is what the actual problem is. I understand people should have commonsense to understand it.
Of course we understand it. What we don't understand is what happened instead. Exception? Data corruption? Nothing? Computer exploded?
You aren't going to get anywhere here or indeed in life by making rude remarks about common sense to people who are trying to help you. You provided one binary digit of information. You needed to provide more. Would you accept that as a bug report from a user? or would you ask for some details? -
Uncompress and extract tar.Z file issue
Does anybody could help me on how to properly and untar files in with tar.Z extension.
Looks like files where tar with gtar utility and compressed on top of it. (O/S AIX)
I used following method to uncompress and extract actual file and some files worked but large files (> 10 G) give me trouble
Here is my example:
uncompress data1.dbf.tar.Z
##This creates data1.dbf tar file
tar -xvf data1.dbf.tar
This gives me following message
x data1.dbf, -2594003015419476674 bytes, -5066412139491164 tape blocks
and creates 0 byte data1.dbf fileOne would assume
firstly: this is not an Oracle problem
secondly: gtar has a -x switch, and man gtar would tell you all about it
thirdly: maybe the filesystem you are untarring to doesn't allow files greater than 2G.
Who can tell?
Sybrand Bakker
Senior Oracle DBA -
How do i install the firefox-4.0b12.tar.bz2 file? on ubuntu 10.10
i tried looking it up, but i still have no luck. can you guys please explain it step to step... i installed in on my windows 7 os and i loved it. now i want it on my ubuntu 10.10
See these support articles. <br />
https://support.mozilla.com/en-US/kb/Installing+Firefox+on+Linux <br />
https://help.ubuntu.com/community/FirefoxNewVersion/MozillaBuilds -
I have the com.ice.tar package from http://www.trustice.com/java/tar/ and I have the code shown below compiling just fine. However, I need to extract .tar files and this code will only extract tar.gz files. Does anyone know what I need to change to my code to get it to extract .tar files? Thanks,
import com.ice.tar.*;
import javax.activation.*;
import java.io.*;
import java.util.zip.GZIPInputStream;
public class untarFiles
public static void main(String args[]) {
try {
untar("c:/Files/AnyFile.tar.gz",new File("c:/Files/"));
catch(Exception e) {
e.printStackTrace();
System.out.println(e.getMessage());
private static void untar(String tarFileName, File dest) throws IOException {
//assuming the file you pass in is not a dir
dest.mkdir();
//create tar input stream from a .tar.gz file
TarInputStream tin = new TarInputStream( new GZIPInputStream
( new FileInputStream(new File(tarFileName))));
//get the first entry in the archive
TarEntry tarEntry = tin.getNextEntry();
while (tarEntry != null){//create a file with the same name as the tarEntry
File destPath = new File(dest.toString() + File.separatorChar + tarEntry.getName());
if(tarEntry.isDirectory()){
destPath.mkdir();
} else {
FileOutputStream fout = new FileOutputStream(destPath);
tin.copyEntryContents(fout);
fout.close();
tarEntry = tin.getNextEntry();
tin.close();
}hey ppl, i have the same assignment of extracting tar.Z files using java.
I have the same trustice.com library com.ice.tar
I've used basically the same code given in the previous post.
It is givin me the followin exception when i try using tar.Z files :
com.ice.tar.InvalidHeaderException: bad header in block 0 record 0, header magic is not 'ustar' or unix-style zeros, it is '-50112-51-424592-71', or (dec) -50, 112, -51, -42, 45, 92, -71
at com.ice.tar.TarInputStream.getNextEntry(Unknown Source)
at filterdialog.readTar(filterdialog.java:101)
at filterdialog$1.actionPerformed(filterdialog.java:80)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source) -
hi...
I downloaded firefox-4.0b6.tar.bz2
then I extracted the files to a directory named "Firefox" .
so someone please help me. What to do next?
do i have to relocate this directory to place where firefox is installed.
kindly tell me the exact steps needed.https://support.mozilla.com/en-US/kb/Installing+Firefox+on+Linux
-
Ok guys,
I have a program that extracts the contents of a tar.gz file. Right now it does extract one of the files and then throws an error:
com.ice.tar.InvalidHeaderException: bad header in block 9 record 10, header magi
c is not 'ustar' or unix-style zeros, it is '1141115144674854', or (dec) 114, 11
1, 51, 44, 67, 48, 54
at com.ice.tar.TarInputStream.getNextEntry(Unknown Source)
at Extract_TAR_GZ_FILE.untar(Extract_TAR_GZ_FILE.java:37)
at Extract_TAR_GZ_FILE.run(Extract_TAR_GZ_FILE.java:55)
at Extract_TAR_GZ_FILE.main(Extract_TAR_GZ_FILE.java:67)
bad header in block 9 record 10, header magic is not 'ustar' or unix-style zeros
, it is '1141115144674854', or (dec) 114, 111, 51, 44, 67, 48, 54 The class that extracts the files:
import java.io.*;
import com.ice.tar.*;
import javax.activation.*;
import java.util.zip.GZIPInputStream;
public class Extract_TAR_GZ_FILE {
public static InputStream getInputStream(String tarFileName) throws Exception{
if(tarFileName.substring(tarFileName.lastIndexOf(".") + 1, tarFileName.lastIndexOf(".") + 3).equalsIgnoreCase("gz")){
System.out.println("Creating an GZIPInputStream for the file");
return new GZIPInputStream(new FileInputStream(new File(tarFileName)));
}else{
System.out.println("Creating an InputStream for the file");
return new FileInputStream(new File(tarFileName));
private static void untar(InputStream in, String untarDir) throws IOException {
System.out.println("Reading TarInputStream... (using classes from http://www.trustice.com/java/tar/)");
TarInputStream tin = new TarInputStream(in);
TarEntry tarEntry = tin.getNextEntry();
if(new File(untarDir).exists()){
while (tarEntry != null){
File destPath = new File(untarDir + File.separatorChar + tarEntry.getName());
System.out.println("Processing " + destPath.getAbsoluteFile());
if(!tarEntry.isDirectory()){
FileOutputStream fout = new FileOutputStream(destPath);
tin.copyEntryContents(fout);
fout.close();
}else{
destPath.mkdir();
tarEntry = tin.getNextEntry();
tin.close();
}else{
System.out.println("That destination directory doesn't exist! " + untarDir);
private void run(){
try {
String strSourceFile = "G:/source/BROKERH_20080303_A2008_S0039.TAR.GZ";
String strDest = "G:/source/Extracted Files";
InputStream in = getInputStream(strSourceFile);
untar(in, strDest);
}catch(Exception e) {
e.printStackTrace();
System.out.println(e.getMessage());
public static void main(String[] strArgs) throws IOException{
new Extract_TAR_GZ_FILE().run();
}The file I tested with can be found here:
http://www.yourfilehost.com/media.php?cat=other&file=BROKERH_20080303_A2008_S0039.TAR.GZ
Any help? Thanks a bunch.I fixed the problem. It was the ftp transfer of files program which wasn't set to BINARY mode. I edited that program and then rerun the above class and boom.. It worked.
Thank you guys for responses.Great! Glad you got it working.
~ -
Extract multiple tar.gz files
hey people
I.ve got a problem here. I.ve got a folder with about 100 .tar.gz files, and I want to extract them all with 1 command. How do I do this? "tar zxvf *.tar.gz" doesn.t work...
cheersfind . -name "*.tar.gz" -exec tar xvzf {} ;
-
How to extract a .tar.gz file in IBM AIX 6.1
we are in R12.1.3 on IBM AIX 6.1,we took the cold backup of prod Instance using the below command
nohup tar cvf - /u01/oracle/prod/db | gzip > /u01/backup/backup_prod/prod_db.tar.gz &
nohup tar cvf - /u01/oracle/prod/apps | gzip > /u01/backup/backup_prod_8035/prod_apps.tar.gz &
we tried to extrac the above 2 .tar.gz files on the same server using below commands, they are extracting on source location i.e /u01/oracle/prod/db.so original files getting updated with old one
cd /u01/backup/backup_prod_8035
$gunzip < prod_apps.tar.gz | tar xvf -
$gunzip < prod_db.tar.gz | tar xvf -
Please let me know how to extract this files in the same folder with out affecting the original files
Thanks in advanceHelios,
Thank you very much for your reply
Is it possible to do both gzip and tar -xvf in single commnd because we don't have that much space on the server
when we execute gzip -d /u01/backup/backup_prod/prod_db.tar.gz it will create file as prod_db.tar again we need to execute
tar -xvf /u01/backup/backup_prod/prod_db.tar
In the above command either we need to give . to untar the files in the same directory same like Linux.
With out . in aix the untar files are over riding on source location i.e /u01/erp/prod
Please advice -
Jar File for uncompress *.tar.Z-File
hello,
i'm locking for a jar -file to uncompress *.tar.Z files but i cant't found souch a jar file.
do you know where i can download a jar-file wich suppose to extract a *.Z-Archiv? You do you know how i can extract a *.tar.Z-Archiv?
Torstenhello,
i'm locking for a jar -file to uncompress *.tar.Z files but i cant't found souch a jar file.
do you know where i can download a jar-file wich suppose to extract a *.Z-Archiv? You do you know how i can extract a *.tar.Z-Archiv?
Torsten -
How can I get firefox-9.0b6.tar.bz2 to install in Linux Mint 10 Julia?
When I try to open/load the downloaded new version: firefox-9.0b6.tar.bz2 with the default Archive Manager in Linux Mint 10 Julia I get this error message:
"bzip2: Compressed file ends unexpectedly; perhaps it is corrupted? *Possible* reason follows. bzip2: Inappropriate ioctl for device Input file = (stdin), output file = (stdout) It is possible that the compressed file(s) have become corrupted. You can use the -tvv option to test integrity of such files. You can use the `bzip2recover' program to attempt to recover data from undamaged sections of corrupted files. tar: Unexpected EOF in archive tar: Error is not recoverable: exiting now"
Perhaps it is also of note that I am running Linux from a thumbdrive through the USB port on my Asus EeePC.
=== What do I do so I can get firefox to work? This began because I can't get Adobe flash and gmail to work properly and realize (at least for gmail) I need to upgrade.Can you open any other Firefox tar.bz2 archives?
*http://www.mozilla.com/en-US/firefox/all.html
*http://www.mozilla.com/en-US/firefox/all-older.html
*http://www.mozilla.com/en-US/firefox/all-beta.html -
Recursive scanning of .tar.bz2 archives / Older release notes
This is actually a two part question, but the two parts are somewhat related. 1) Recursive scanning of .tar.bz2 archives If I create a new content filter to match on executables (attachment-filetype == "Executable") this detects directly attached exe files. It also detects exe files in .zip-archives, and it detects renamed exe files in .zip archives. All is well. What it does not detect are exe files in .tar.bz2 archives. This surprised me as this is not an especially obscure format, and the Ironport lists tar and bz (along with zip) in the Compressed mime category. Maybe this is a bug, and it's fixed in a newer release (this is on 6.5.2-101). Which brings me to the next question 2) Older release notes Where can I find release notes for the releases between 6.5.2-101 and the current release (7.0.1), in order to find if this was fixed along the way?
Not sure about the tar.bz2 archives, but the older release notes can be found on the support portal under Appliance Documentation > Email. There is a small link at the top right corner of the page "earlier releases". Yes, its very well hidden
-
Reading a tar/bzip2 file.
Is there any way can I read, maybe a stream, a file in tar and bzip2 form(.tar.bz2)?
First you need to read the bzip2 format
[http://www.google.co.uk/search?q=bzip2+java]
into something which can read tar format
[http://www.google.co.uk/search?q=tar+java]
Maybe you are looking for
-
My wife recently switched from an iPhone to a Samsung and she can send texts but she can't receive them nor receive emails. Her iPhone has had her info removed and the settings have all been set to default. What else does she need to do to correct th
-
Where can I get Russian Typeface Font for Mac?
I'm desperately trying to get hold of some Russian Constructivist Typeface (Font) which I need for a project I'm working on. Does anyone know any software that has this on which is readily available? Be grateful for any help. Pluginbaby
-
Putting sql code in a ejb cmp method
hi i was wondering if there are any performance implications with creating a method in a cmp bean that performs an sql query as opposed to putting the query in the ejb deployment file. the reason i did this is that the ejb is quering a different tabl
-
Anyone using Assassin's Creed 4 on 2012 MacBook Pro Retina?
I have a 2012 Retina MacBook Pro running 64-bit Windows 7 in Boot Camp. I've run a number of other graphics-heavy games such as FarCry 3 and Crysis 3 just fine on this machine. Unfortunately Assassin's Creed 4 insists on running at a very low resolut
-
Revaluation with Log. Invoice Verification - MRNB
Hi there, We would like to know if 1. Multiple POs could be processed through transaction MRNB at one time. 2. it is possible to Park or block the invoice through MRNB. Thanks, Gajanan