Java make tar file and download






















Jon Heller Martin Ba Martin Ba Whats the problem? It's a gzipped tar file containing the JRE. Those are installer-free aka "portable" versions of the JRE. Just unzip them and you can use them. Note they've also started doing this for 8u20, couldn't find tar. Or, rather, I couldn't find any information, like, any blog entry where someone wrote: "Hey cool, now we have installer free versions.

I find that odd. Therefore this question to have something for future reference :- — Martin Ba. I have done PrivateJRE. I installed regular java-setup. Show 2 more comments. Active Oldest Votes. Improve this answer. Stephen C Stephen C k 90 90 gold badges silver badges bronze badges. Add a comment.

Sign up or log in Sign up using Google. Refer How to Untar a File in Java to see how to untar a file. Steps to create tar files Steps for creating tar files in Java are as follows- Create a FileOutputStream to the output file. Then you need to read all the files in a folder. If it is a directory then just add it to the TarArchiveEntry. Folder Structure used Here is a folder structure used in this post to read the files. Test abc. BufferedInputStream; import java.

BufferedOutputStream; import java. And the line numbers in the stack trace are pointing to the line that says tos. From the message, it looks like the tar tool expects you to specify the size of an entry before you write to it. I see that TarEntry has a setSize method. I imagine you should try inserting a line like te. I note that TarEntry has other constructors, and one of these takes a File as an argument.

And the documentation says that it constructs the header for you based on the information in the file. To me, this sounds like less work for the programmer.

Less work is good. My experience is that if the thing you're talking about is a file, then a File object is much more useful that a String representing a file name.

If you use a File rather than a String, you usually end up doing less work. Again, less work is good. After some changes from what you have said, i got the following error : com.

Some versions of tar do not support names paths, really longer than chars. Fortunately there seem to be other choices. I don't see a way to use com. But it looks like org. Try this: tos.



0コメント

  • 1000 / 1000