I have the following code;
String files="";
for (int i=0; i<filelist.size()-1;i++)
{
files=files+filelist.get(i).getPath()+", ";
}
files=files+filelist.get(filelist.size()-1).getPath();
System.out.println(files);
Process zipping=new ProcessBuilder(
"C:/Program Files/7-Zip/7z.exe", "a", "-t7z", "C:/Users/Pc/dog/test", files).start();
OutputStream steam=zipping.getOutputStream();
DbxClientV2 client = new DbxClientV2(config, ACCESS_TOKEN);
FileInputStream in =new FileInputStream(new File("C:/Users/Pc/dog/test.7z"));
client.files.upload("/test.7z").
uploadAndFinish(in);
Which gives java.io.FileNotFoundException: C:\Users\Pc\dog\test.7z
error.
In addition, though the archive file is created, it does not contain the given files, which are given as;
C:\Users\Pc\Documents\untitled3.png, C:\Users\Pc\Documents\untitled2.png
You're starting the process, but you're trying to use the file before it's had much of a chance to get going.
I suspect you need to wait for it to finish:
zipping.WaitForExit();
See more on this question at Stackoverflow