Skip to content
Advertisement

Put a file Json (array) into a zip file [Java]

Hello I’m new to java and my english is not good as well lmao I need to put a file json (it’s an array json) in a file zip trought java but i tried multiple solution and doesn’t work 🙁

this is my code:

JavaScript

any help ? regards

Advertisement

Answer

You are creating a ZipEntry but you are not adding the file content, so your resulting file is empty. You have to read the file and add the contents to the ZipOutputStream instance. Here is an example:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement